Can I switch the default unity compiler?
I’d like to compile with
msc (Mono Compiler page) so I can use a .NET 4.5 assembly. Trying to switch target version to .Net 4.5 in MonoDevelop will result in Unity resetting it… And Unity will compile it using .NET 3.5 anyways.
Or is there another way using it without writing a C++ wrapper or converting it to .NET 3.5 (Having the option to do so though, the library is open source and I already started to convert)?
The limitation isn’t about the compiler. You can compile your scripts manually into an assembly. The problem is the Mono runtime that comes with Unity only supports .NET 3.5 and a few 4.0 features. The monoruntime is part of the Unity engine itself. When you use a C++ wrapper for a 4.5 .NET assembly you will actually make Unity’s mono runtime to do a native call into your wrapper and the wrapper will load the whole .NET runtime which the host computer has to actually run your 4.5 code. This is quite inefficient.
If it’s not a too large library i would convert it. If it’s too compex to be converted, find an alternative ^^. Either one that is suported by Unity or directly find a native library.