yasirkula / UnityIngameDebugConsole

A uGUI based console to see debug messages and execute commands during gameplay in Unity
MIT License
2.14k stars 224 forks source link

[Unity 2020.2.4f1]NotSupportedException error occurs during playback when URP is installed #47

Closed Piorimu closed 3 years ago

Piorimu commented 3 years ago

I'm not an English speaker, I'm using Google Translate. Sorry.

Description of the bug

When I deploy URP, I get a NotSupportedException error when playing.

NotSupportedException: The invoked member is not supported in a dynamic module.

Judging from the error message, it seems that the same phenomenon occurs not only in URP but also in packages where assemblies are dynamically generated.

Reproduction steps

  1. Unity2020.2.4f1, create a project with Mobile2D template
  2. Install this repository from OpenUPM (openupm add com.yasirkula.ingamedebugconsole)
  3. Install Universal RP from Package Manager
  4. Place the InGameDebugConsole prefab in the initial scene
  5. Play
  6. Error occurred

Platform specs

Please provide the following info if this is a Unity 3D repository.

Additional info

Error Message

NotSupportedException: The invoked member is not supported in a dynamic module. System.Reflection.Emit.AssemblyBuilder.GetExportedTypes () (at <9577ac7a62ef43179789031239ba8798>:0) IngameDebugConsole.DebugLogConsole..cctor () (at Packages/com.yasirkula.ingamedebugconsole@1.4.1/Plugins/IngameDebugConsole/Scripts/DebugLogConsole.cs:160) Rethrow as TypeInitializationException: The type initializer for 'IngameDebugConsole.DebugLogConsole' threw an exception. IngameDebugConsole.DebugLogManager.OnEnable () (at Packages/com.yasirkula.ingamedebugconsole@1.4.1/Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs:403)

yasirkula commented 3 years ago

OpenUPM version is apparently not up-to-date. I've asked OpenUPM team about this issue now. In the meantime, you can import the plugin via other methods explained here: https://github.com/yasirkula/UnityIngameDebugConsole#installation

Piorimu commented 3 years ago

Thank you for your reply and I'm sorry. I noticed that it has been fixed in the latest version.

https://github.com/yasirkula/UnityIngameDebugConsole/blob/716e23c6706703991b46de715cddde5af12b8845/Plugins/IngameDebugConsole/Scripts/DebugLogConsole.cs#L147

I noticed a mistake, so I tried the following:

(via Package Manager) add the following line to Packages/manifest.json: "com.yasirkula.ingamedebugconsole": "https://github.com/yasirkula/UnityIngameDebugConsole.git",

After installing this way, the error disappeared. Thank you.