Search Unity

.net plugin's .net Target framework version?

Discussion in 'Editor & General Support' started by gyzhou, Apr 25, 2016.

  1. gyzhou

    gyzhou

    Joined:
    Apr 25, 2016
    Posts:
    7
    I am new to unity. I currently try to create a CLI/C++ project to wrap up a native library for unity as a managed plugin. The unity version I have is 5.3.4f1. I would like to know which .net target framework version I should set for CLI/C++ project.
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    It's Net 3.5, but Unity won't see your CLI/C++ dll as a managed assembly, because Unity uses Mono, while CLI/C++ will require Microsoft .Net. You'll still be required to use Platform Invoke instead.
     
  3. gyzhou

    gyzhou

    Joined:
    Apr 25, 2016
    Posts:
    7
    Would you please explain a little bit more of "Platform invoke". Could you point me to some docs. Thanks.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
  5. gyzhou

    gyzhou

    Joined:
    Apr 25, 2016
    Posts:
    7
    I guess you suggest a native plugin and then do a managed wrapper in mono. Is this correct? Thanks.
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Well to be more precise - native library and managed library (which would have functions inside with DllImport("<nativelibrary>"), that managed library would both work on Mono and Microsoft .NET

    But yes, you're correct.