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.
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.
Would you please explain a little bit more of “Platform invoke”. Could you point me to some docs. Thanks.
See this - https://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx?f=255&MSPPError=-2147217396, basically it’s the usage of DllImport attribute which allows you to call in to the native library.
Also see this - Unity - Manual: Native plug-ins
I guess you suggest a native plugin and then do a managed wrapper in mono. Is this correct? Thanks.
Well to be more precise - native library and managed library (which would have functions inside with DllImport(“”), that managed library would both work on Mono and Microsoft .NET
But yes, you’re correct.