简体   繁体   中英

Unhandled Exception: System.Reflection.ReflectionTypeLoadException in Unity3d

I'm getting this error: compile time error when running i have searched on unity forum they are saying its for the System.Web.dll file issue, i have cleared that, also reimported assets but its still not working.

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

the answers i got from unity are :

and none of them helped me.

The problem is caused by the Unity.PackageManager.dll in your project. Delete that and it will be gone.

You've also got a folder under Editor that contains a bunch of editor scripts for Standard Assets, but you don't have Standard Assets Installed, so you're going to get a bunch of compiler errors from that. Delete the Editor folder or install Standard Assets and it will work.

I'm not sure where you got the tutorial files, but nothing in this project seems to work correctly. All the scenes are empty. I would advise you go find a different tutorial.

Problems like this could be related to "Target Framework" setting in the DLL's compilation options. Which should be considered for already compiled system DLL's too.

So in your case, I think you might be using the wrong DLL version. If you need to import extra system DLL's, make sure you get them from Unity installation folder:

C:\\Program Files\\Unity\\Editor\\Data\\Mono\\lib\\mono\\2.0

Beware that there might be multiple DLL's with the same name in other subfolders like MonoBleedingEdge. Make sure you use the folder above.

In case you build a DLL on your own, "Target Framework" setting should be set to a proper one. You may figure out the correct setting by trying.

I was getting this error when referencing a dll I had compiled with platform target set to Any CPU . Fixed by changing it to x86 .

I fixed this error, when change Target framework to .Net Framework 3.5 , and set the Copy Local to false of UnityEngine's references.

And after dragging the dll, the error is gone.

Hope this will help.

Wow I got a version of this Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. nonsense ... after couple hours of crying/raging, reimporting assets, deleting Library/Temp folders, changing platforms, reimporting plugins i finally got past it. Honestly I don't know exactly what fixed it .. ugh that was annoying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM