Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Issues With DLLs

Discussion in 'Editor & General Support' started by Rickikicks, Dec 22, 2013.

  1. Rickikicks

    Rickikicks

    Joined:
    Dec 22, 2013
    Posts:
    2
    Hello,

    I have had a difficult time when using DLLs in Unity. I create these libraries myself in C# in Visual Studios, and they are hardly complicated at all. They are simple things such as reusable interfaces, or network connections. For this example I am using a simple interface which is just a compilation of classes with global variables and references to one another to form dynamic skill trees. When I first added this library to Unity and compiled a couple of scripts and tested the libraries out by displaying info on a GUI to make sure it's working, everything was fine and worked. Fast forward a few hours, it seems at random, I will add a new script in Unity, and try to compile, I get no errors from the script editor, but Unity console has these errors and won't run:

    All compiler errors have to be fixed before you can enter playmode!
    UnityEditor.SceneView:ShowCompileErrorNotification()


    Internal compiler error. See the console log for more information. output was:
    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


    Nothing of importance has changed. It just seems like Unity all the sudden is unable to use the libraries, and will never fix itself unless I remove the libraries and just manually create the scripts within the project itself....This negates the purpose of building libraries. I tried Googling this issue, but without luck. Does anyone have any insight?

    Regards,
     
  2. Raphael-Jeongho-Eom

    Raphael-Jeongho-Eom

    Joined:
    Sep 8, 2012
    Posts:
    36
    Hum.. you might can narrow the point of error by using try, catch statement.

    Code (csharp):
    1.  
    2. try{
    3.   go.AddComponent<SomeComponent>();
    4. }
    5. catch (Exception e){
    6. }
    7.  
    And, it will be helpful, if you share the sources.
     
  3. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Are you sure you targeted the correct framework version? Make sure your project targets .NET 3.5 before compiling and make sure you're not referencing anything that's not supported by Unity (such as System.Data).
     
  4. Rickikicks

    Rickikicks

    Joined:
    Dec 22, 2013
    Posts:
    2
    Oh, wow. I must have missed the memo on that one. I didn't realize Unity didn't support .NET 4.0. I bet that's the issue.

    Thank you kind sir.