4

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Divya
  • 1,469
  • 1
  • 13
  • 25
  • Are you using Mono .net 3.5 or below? Check the .net version of your System.web.dll. – David Mar 29 '15 at 15:21
  • Possibly you are missing another dll that System.Web is looking for. I guess the real question is, what are you trying to do with System.Web? – Tyler Day Mar 29 '15 at 16:13
  • @David i m using 4.5 . – Divya Mar 29 '15 at 16:44
  • @TylerDay i seached for this issue on official unity sitte but the answer that i got are not helping me .they say about the issue is with system.web and i m unable to locate wt it is !! – Divya Mar 29 '15 at 17:03
  • There's not enough information here. You don't tell us anything about what's in your project or what you're trying to do. Is this running a game build or in the editor? Have you tried building an empty project? It's possible you have something in your project that is choking Unity. An incompatible DLL perhaps. – Guavaman Mar 30 '15 at 18:17
  • @Guavaman i m following this tutorial on youtube https://www.youtube.com/watch?v=3cB3iARj3m4 and i got stuck with this issue. – Divya Mar 31 '15 at 09:23
  • Zip your project and upload it to Dropbox or something and post a link. I'll take a look. – Guavaman Mar 31 '15 at 18:14
  • @Guavaman here is the link : https://www.sendspace.com/file/bqnzkw – Divya Apr 01 '15 at 07:51
  • I posted the answer below. – Guavaman Apr 01 '15 at 17:46

5 Answers5

4

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.

Guavaman
  • 450
  • 1
  • 5
  • 12
  • i have already done that thing.to delete that dll as Can asked me to do .but it gives 39 errors after that.also i have standard assets installed.i have deleted those files and it runs now :) but that dll has nothing to deal with that. – Divya Apr 01 '15 at 17:59
  • The DLL is what was causing the System.Reflection.ReflectionTypeLoadException. Deleting that DLL reveals the other 39 compile errors because it can't even get to the point of checking the CS or JS files in your project until that TypeLoadException is resolved. – Guavaman Apr 01 '15 at 21:04
2

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.

Can Baycay
  • 875
  • 6
  • 11
  • which DLL i should import in this case ?? i m unable to get which one is creating problem .as unity forum says its for system.web.dll ,i tried to change the .Net version but its still the same issue. – Divya Mar 30 '15 at 08:26
  • I need to know what DLLs you are trying to import. Can you search for *.dll in your project's Assets folder and write down all results here? – Can Baycay Mar 30 '15 at 09:20
  • i have 2 dll files 1 .Assembly-UnityScript.dll (in lib folder )and unity.packagemanager.dll (in assets folder) – Divya Mar 30 '15 at 09:29
  • Alright. It's not wise to touch lib folder since Unity uses this folder for temporary purposes. And it's unlikely for lib folder to cause anything bad. So we are left with Unity.PackageManager.dll. I'm not sure if this DLL was intentionally dropped to the Assets folder or if it's by accident. This is one of Unity's internal DLLs I think. So let's try to remove it from Assets and see if everything works as expected (keep a backup). – Can Baycay Mar 30 '15 at 11:26
  • i did that..but it gave 39 errors.also one of its "the type or namespace name "antialiasing could not be found Are you missing a using directive or an assembly reference? " i m using unity 5 downloaded past 5 days back, – Divya Mar 30 '15 at 11:57
  • These errors are probably not related to Unity.PackageManager.dll and should be solved separately. Are you trying to import an old package or maybe trying to convert an old project to Unity 5? We could help better if you tell what you are trying to do in detail. – Can Baycay Mar 30 '15 at 12:04
  • i m following mybringback tutorial on youtube for unity3d and in the 2nd last tutorial i got stuck with this issue while compiling. – Divya Mar 30 '15 at 12:08
  • The problems you are struggling with probably easy to solve when you get enough knowledge to work comfortably with Unity. So I would suggest to move on and start a new project for another tutorial if this one is not that important. – Can Baycay Mar 30 '15 at 12:17
  • yup i will do that...:) thanks buddy for your time :) you seems to be good at unity .also .if you dnt mind will you help me in unity to learn as i m just a beginner so want to do masters in it.my skype id : stacktrace8 thanks :) +1 for your effrorts – Divya Mar 30 '15 at 12:23
0

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.

Mikey G
  • 3,473
  • 1
  • 22
  • 27
0

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.

tim
  • 1,454
  • 1
  • 25
  • 45
0

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.

Christopher
  • 1,639
  • 19
  • 22