Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

How to change the .net framework version of the Unity?

Discussion in 'Scripting' started by ricardosobrado, Mar 22, 2012.

  1. ricardosobrado

    ricardosobrado

    Joined:
    Mar 22, 2012
    Posts:
    1
    Hi everyone!
    I need to import a dll file that was created in version 2.0 of .Net framework and therefore cannot be imported by any script in unity because of its current version (4.0). How can i change the unity .net version to 3.5 or minor? I also verified that change the .Net framework version of monodevelop doesn't change the framework version of the Unity :( Can anyone help me please? Thanks in advance!
     
  2. George Foot

    George Foot

    Joined:
    Feb 22, 2012
    Posts:
    399
    You should be able to import old assemblies without problems. Are you sure you're not trying to import a 4.0 DLL? This is the one that's especially not supported.

    Otherwise, it's likely that your DLL just references some other DLL which is not included in Unity. It could be a system DLL, or some other middleware.
     
  3. Tobias J.

    Tobias J.

    Joined:
    Feb 21, 2012
    Posts:
    423
    I have been wondering about the .NET version as well.

    If I go to File->Build Settings, and then click 'Player Settings' and look under 'Other settings', there is listed something about 'API Compatibility Level', and I have two options: .NET 2 and a subset of .NET 2.

    I took this to mean that Unity supported .NET 2 at best, but perhaps that isn't what that option is all about?

    If not, what is it about, and what version(s) of .NET does Unity support?
     
    mdrunk likes this.
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Unity is built on top of a modified Mono 2.6 and as such only supports the old .NET. So George is right, you can only use 'old clr' assemblies -> .NET 3.5 and lower, no .NET 4 ones.
    The settings you see there are related to the type of core .net framework unity will use, the full 2.0 one or an own custom slimed version thats not as big / bloated, which one you need to use depends on the classes you use ie if they are present in the subset or not

    You can not choose to use anything but Unitys '.NET 2', especially not anything compatible to .NET 4
     
    Last edited: Mar 22, 2012
  5. Hannibalov

    Hannibalov

    Joined:
    Aug 8, 2012
    Posts:
    6
    Hi everyone,

    Is there any way to change the default to be .Net 2 and not .Net 2 subset? Or even change it by script? I use a library in all my projects that crashes when .Net 2 subset is active, and I'm tired of changing it every time.

    Is that even possible? Thank you
     
    v_gasan_daqri likes this.