- Home /
What is Mono? Is it a compiler? A language? Or what?
This is a question originally posted to the forums in Boo, C# and JavaScript in Unity - Experiences and Opinions by Godheval that I felt was of general interest, so I'm reposting (and answering) it here:
Godheval asked:
All this stuff about Mono totally confuses me. Is Mono a compiler? And speaking of compilers, can I learn all I need to learn of C# to use Unity with Visual C# Studio Express? Or do I need the full version?
Answer by ericksson · Dec 02, 2009 at 05:02 PM
The answer is here: http://www.mono-project.com/What_is_Mono. Mono has a C# compiler, a runtime and a lot of libraries.
And this is the Unity3D page explaining how to integrate Unity with Visual C# (separated explanation for different Vsiual Studio C# editions): http://unity3d.com/support/documentation/Manual/VisualStudioIntegration.html
Also, you can learn C# from anywhere (a book, internet tutorials, etc.), but for basic Unity coding you need to know the C# basics. Then, learn the Unity API (using Unity's API and Scripting Reference) and putting this knowledge together you can get up and running with Unity scripting using C# pretty fast.
Answer by jashan · Dec 02, 2009 at 05:22 PM
Mono is a development framework which is equivalent with the .NET Framework (which obviously also is a development framework). A very similar development framework or "plattform" is Java (.NET is called ".NET Framework", Java is called "Java Platform"). I think it's important to understand that "Java" is not just a programming language. It's also a programming language - but the interesting thing about Java (IMHO) isn't so much the language but the APIs (application programming interface) that are an integral part of the Java Platform. An "API", btw, is what you see when you open the Scripting Reference of Unity (that is the documentation of the API that Unity provides).
Oh: And Java has nothing to do with JavaScript (well, except for some marketing purposes in the very early days).
In both cases (Java and .NET), there's different versions of the framework / platform: For Java it's J2ME, J2SE and J2EE (for mobile development, "standard development" and "enterprise development"). With .NET, I'm aware of "general .NET" and .NET compact framework. Java is available for most platforms but only supports a single language (I think there's projects that compile other languages into Java-bytecode but that's just not that common). .NET "by design" supports multiple languages, for example C#, Visual Basic, C++, a dialect of Java and many others.
The Java platform is implemented for many different computer platforms (it was "designed" to be "platform independent"). .NET is available for Windows only - but another implementation of the .NET framework - called Mono - is available cross-plattform (Windows, Mac OS, Linux ... probably other OSs I'm not aware of). In principle, Mono is just another implementation of the framework specified with the .NET framework (in practice, I think Mono is a lot more but to keep things simple I'll stay with "in principle" ;-) ).
Development frameworks / platforms usually provide SDKs (software-development kits), and SDKs usually provide compilers. Both .NET/Mono and Java also provide a special kind of "runtime environment", so the programs are not directly executed on the processor but actually by another program. That's how (operating system)-platform independence, and even processor-architecture independence is achieved. That was also (according to my knowledge) the first time the term "virtual machine" was used very widely: The Java runtime environment is in fact called "virtual machine" (while by now, most people would use "virtual machine" for virtualization environments like VMWare or Parallels). Such a "virtual machine" executes "bytecode" which is an intermediary language the original code (written in a programming language like Java (the language), C#, C++, Visual Basic, Boo or JavaScript) is compiled into. So, bytecode is in-between assembly-code (or actually: binary machine code) and a high-level language like C# etc.
Now, there's one very important thing to know regarding Mono and Unity: Unity is not built on top of Mono. If that was the case, Unity would be cross-plattform by nature (there would be a Linux version ... or it would be comparatively easy to create one). Unity is a "native" application built - I think ... mostly - in C++. However, Unity uses Mono as its scripting framework. Which is quite a genius thing because .NET or Mono is a very powerful programming framework - and by having that integrated into Unity you can tap into the whole of this power.
The C# available in Unity (currently, in 2.6) is pretty much the same available in Visual Studio 2005 (that's when Microsoft introduced the .NET Framework 2.0 which is essentially what's available in Mono 1.2.5 which is what Unity currently uses). The current version of Visual Studio (2008) supports the .NET Framework 3.5 in which C# has quite a few extra-features that are currently not available in Unity; which will very likely change "somewhat soonish" because Mono 1.2.5 is really old...
For the language, C#, Visual Studio 2005 and Unity are "pretty much the same". However, when developing with Unity, what matters more to you than the language is the API. And, in addition to what the .NET Framework provides, Unity provides its own API which is documented in the scripting reference (see above).
So, what I'd recommend for learning C# (if you're new to programming and don't want to overwhelm yourself): First learn C# by doing C# tutorials for beginners, and use the "somewhat simpler" environment that Visual Studio provides (Express is fine for that). Once you feel comfortable with the core concepts of programming (object oriented programming, to be exact), switch over to Unity. There's also a very nice tutorial for C# on the Wiki which covers the basics of programming and C# - and does so in the context of Unity. So that's a really good resource to start with.
Thank you, nice write-up... do take a look at:
[~~~ ework", Java is called "Java Platform"). I think it's important to understand that "Java" is not just a program$$anonymous$$g language. It's also a program$$anonymous$$g language - but ~~~]
Just $$anonymous$$or detail: $$anonymous$$ONO is the OpenSource implementation of .NET - made 100% by community from the open specifications $$anonymous$$icrosoft have published for .NET - so, unless you use Windows specific API calls such as Winforms, you will be able to reuse almost any .NET code in $$anonymous$$ONO.
That is extra great if you find some good examples writting in C# for .NET, as they usually are very easy to use with $$anonymous$$ONO Framework.
$$anonymous$$ONO is usually a little behind the latest release of .NET regarding implementation of new features. Eg. LINQ-to-SQL came a bit later I think.
Answer by LyalinDotCom · May 31, 2016 at 01:25 PM
It's also worth noting here that Visual Studio 2015 Community edition is now the best way for many people to get the editor "for free", though please check the license for details, as its not for everyone, licensing details are here.
You can learn all the details about how to get both Unity and Visual Studio 2015 in our Unity page: https://www.visualstudio.com/en-us/features/unitytools-vs.aspx
For full transparency, i work on the Visual Studio team but just thought this was useful to add into the discussion.
Your answer
Follow this Question
Related Questions
Explanation of the System and Mono Namespaces 1 Answer
Change MonoDevelop c# compiler output language 1 Answer
What are the Syntax Differences in C# and Javascript? 7 Answers
how can use GUI.Button? framework don't recognize or suggest the method 1 Answer
Unity 5.3.1 and Visual Studio 2015: Project Target Framework Not Installed Error Message? 4 Answers