- Home /
Unity .net framework 4.5
Hi all! I have some questions here:
1. Why unity uses outdated mono-2.x scripting backend, Currently mono 4.2 is out, why unity not using it?
2. Why I can't just choose libraries like .net framework 4.5??
3. Current my code requires at least .net framework 4.0, so in unity it has many errors. There's any way to solve this?? without converting my code to .net framework 2.0
Answer by Treiger · Jul 31, 2016 at 03:05 PM
They can't just update it, there is a lot of work that needs to be done on the back end before that happens, like their IL2CPP system. If I recall, they use a custom version of mono-2.x as well, to maintain platform compatibility.
There are many features that just aren't compatible due to the outdated compiler and the fact that it has around .Net 2.0/3.5 compatibility. Read more here: http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-in-unity/
Not that I know of. If you're willing to wait a couple years, then it'll be solved. If you aren't, start converting.
Also note there's a difference between actual "framework features" and "compiler features". If you have some code that was written for a newer C# version it might not compile inside Unity but you might be able to compile it in Visual studio using .NET 2 (maybe 3.5 will work as well). If it compiles there you can simply place the compiled assembly into your project and it should work. Since you can only use things that .NET 2 provides it will work in Unity just fine, even when you used newer compiler features.
The only alternative if the above doesn't work is to port things down to .NET 2.0. Some things might be easy to fix, others might require huge workarounds but essentially it should always be possible. The question is how much time you have and how important it is. I wouldn't wait for a $$anonymous$$ono upgrade in Unity. Some wait for that upgrade for years ^^.
This wasn't ment as critique on Unity. I know how hard it can be to switch to a complete new framework, especially if you consider how many platforms Unity supports. The used framework has to work on all of them.
Your answer
Follow this Question
Related Questions
how to reference a .NET 4 targeted, native code wrapper assembly in Unity (beta)? 0 Answers
System.Threading.Tasks 1' does not exist in the namespace 'System.Threading.Tasks' 1 Answer
Is it possible to reference .NET references and give up cross-platform? 1 Answer
Target Platform for .NET DLLs, And Should I Use Linq? 0 Answers
Delegate Covariance and Contravariance using .NET 4.x Equivalent 2 Answers