Relationship between UnityVS, Monodevelop, and .NET versions

I understand that Mono is a cross-platform port of .NET, and that its compiler is used by Unity when handling C# code (please correct me if I’m wrong). I’ve read that Mono’s implementation of .NET is mostly complete, but that Unity’s Mono license is quite old, providing reliable support for only .NET 2.0. Yet I’ve also read that Unity projects can implement .NET 4.0.

What version of the Mono compiler is Unity actually using? And will it ever be upgraded to the latest version?

Also, I just learned about the availability of UnityVS, and I’m excited to give it a try. But I’m hoping for some clarification - under UnityVS, is Unity’s aged version of the Mono compiler still used?

EDIT: Change “Monodevelop” references to “Mono” to appropriately distinguish between the editor and the compiler.

Yes, Unity still uses its age-old Mono version to compile your game. You can, however, compile your scripts in VS, but it will not be used as the target for your Unity build. e.g. Use it only for syntax testing. That said, I think that anyone that hasn’t made the jump to using UnityVS and VS2013 should already do so, as VS is a more fully featured IDE than MonoDevelop.

The version of Mono used in Unity is approximately equivalent to .NET 3.5. It will be upgraded after all platforms can use IL2CPP.

–Eric

OK, I’m trying to wrap my ahead around the relationship between .NET, Mono, and IL2CPP.

As I understand it, .NET consists of a a framework class library (FCL) that defines a set of classes/tools that can be used by a variety of languages (i.e. an FCL exists for all .NET capable languages). A .NET compiler takes code written in, say, C# and compiles it to an intermediary that is later run by the CLR, essentially a virtual machine similar to what is used by Java. Up until fairly recently, the CLR was a Windows-only affair, so that .NET wasn’t cross-platform - a fairly important requirement for something like Unity. Windows recently open-sourced .NET and is working toward a completely cross-platform solution, but I understand that we are not quite there yet.

Enter Mono. If I understand correctly, Mono compiles .NET code to something that can be run cross-platform without the .NET CLR at all (the JVM, perhaps?) So people can use “.NET” code cross-platform right away because, under the hood, it isn’t really .NET at all. Please correct me if I’m wrong.

How does IL2CPP fit into this picture? From the description here (Unity Blog), it sounds like IL2CPP is its own version of Mono entirely, but instead of compiling code for use with a preexisting VM, IL2CPP aims to move .NET C# code directly to native C++, and leverage existing compilers to produce actual native binaries (meaning, we get the performance benefits of NOT running a VM, but instead running native code).

If this is a correct summary, it sounds like IL2CPP would (or could) replace Mono altogether. But the aforementioned article assures us that Unity will “continue to use the Mono C# compiler (and perhaps later, Roslyn).” What does that mean, exactly? Is Mono going to be an option if you don’t want to use IL2CPP? Or am I misunderstanding the nature of the tech entirely?

Unity uses Mono, which is a cross-platform implementation of .NET.

The .NET term refers to an ecosystem made of a set of languages, class libraries and a runtime that was developed by Microsoft (introduced around 2001 i think).

Mono is a cross-platform implementation of .NET that runs on multiple devices and environments. Unity uses C# (which is a language of the .NET family) to create code that controls the game’s behaviour. The version that Unity refers to .NET 3.5 and is pretty outdated (to say the least).

Mono compiles the code into IL, which is exactly the same IL as you get with the Microsoft version of .NET (they made this a standard i think, called Ecma-335). Mono has its own runtime (like the CLR) to run the code.

IL2CPP is Unity’s future of scripting - you code and compile everything using Mono (using C# or UnityScript as you would before), but then they would transform your code into native C++ code. The plan is to bring IL2CPP to all of the platforms i think…

Lastly, the latest changes of MSFT going open source everything doesn’t really make any changes to anything with regards to Unity (at least not from what i know that was published officially).

1 Like