接前篇Unity 5.3.5p8 C#編譯器升級,本文側重瞭解一些Mono的知識。html
新升級的Mono C#編譯器(對應Mono 4.4)git
Unity編輯器及播放器所使用的Mono運行時還未升級。github
新編譯器仍針對C# 4,是舊的編譯器也支持的版本。shell
新編譯器目標框架爲.Net 3.5,也是以前支持的框架。c#
參考:http://answers.unity3d.com/questions/259448/how-to-determine-mono-version-of-unity-.htmlapp
我在unity 5.3.4f1 中測試有效,而在unity 4.3.4f1下測試無效框架
using UnityEngine; using System; using System.Reflection; public class MonoVersion : MonoBehaviour { void Start() { Type type = Type.GetType("Mono.Runtime"); if (type != null) { MethodInfo info = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); if (info != null) Debug.Log(info.Invoke(null, null)); } //Debug.Log(System.Enviroment.Version);//net version? } }
方法二async
d:\Program Files\Unity_5_34\Editor\Data\Mono\bin>monop2 --runtime-version mono.exe runtime version: 2.0.50727.1433
d:\Program Files\Unity_5_34\Editor\Data\Mono\bin>mono.exe --version Mono JIT compiler version 2.0 (Visual Studio built mono) Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com TLS: normal GC: Included Boehm (with typed GC) SIGSEGV: normal Notification: Thread + polling Architecture: x86 Disabled: none
.NET和Mono二者是徹底獨立的,簡單的理解:Mono項目是第三方的.Net Framework實現,比喻爲.Net的跨平臺版,絕大多數C#的特性在.net和mono中都是相同的,少部分特性二者的實現不一致。編輯器
Mono的目標是建立一系列符合ECMA 標準(Ecma-334
和Ecma-33
5)的.NET 工具,包括C# 編譯器和共通語言執行平臺ide
Mono 虛擬機包含一個實時編譯引擎,該引擎可用於以下處理器:x86,SPARC,PowerPC,ARM,S390(32位模式和64位模式),x86-64,IA64 和64位模式的 SPARC。該虛擬機能夠將代碼實時編譯或者預先編譯到原生代碼。對於那些沒有列出來的系統,則使用的是代碼解釋器。
這部份內容摘自:http://www.mono-project.com/docs/about-mono/
Mono’s C# compiler is feature complete for C# 1.0, 2.0, 3.0, 4.0 and 5.0 (ECMA). A good description of the feature of the various versions is available on Wikipedia.
mono的c#編譯器提供c# 1.0,2.0,3.0,4.0和5.0(ECMA)完整的功能。不一樣版本的特性的描述能夠在維基百科上查看。
The runtime implements the ECMA Common Language Infrastructure (CLI). The runtime provides a Just-in-Time (JIT) compiler, an Ahead-of-Time compiler (AOT), a library loader, the garbage collector, a threading system and interoperability functionality.
mono運行時實現了ECMA 公共語言基礎(CLI)。運行時提供了即時(JIT)編譯器,提早的編譯器(AOT),庫加載器,垃圾回收機器,線程操做,互操做性
The Mono platform provides a comprehensive set of classes that provide a solid foundation to build applications on. These classes are compatible with Microsoft’s .Net Framework classes.
Mono平臺提供了一組全面的類來構建應用程序提供一個堅實的基礎。這些類是兼容微軟的.Net framework
Mono also provides many classes that go above and beyond the Base Class Library provided by Microsoft. These provide additional functionality that are useful, especially in building Linux applications. Some examples are classes for Gtk+, Zip files, LDAP, OpenGL, Cairo, POSIX, etc.
Mono還提供了不少類,甚至超越了微軟提供的基類庫。這些提供額外的功能是有用的,特別是在構建Linux應用程序。一些例子是Gtk +,Zip文件、LDAP、OpenGL,Cairo,POSIX等等。
.Net版本和C#版本:http://www.cnblogs.com/zhaoqingqing/p/5478239.html
.net framework | c# version | note | date |
---|---|---|---|
.net 3.5 | 3.0 | vs2008 | 2007-08 |
.net 4.0 | 4.0 | vs2010 | 2010-04 |
.net 4.5 | 5.0 | vs2012/13 | 2012-10 |
.net 4.6 | 6.0 | vs2015 | 2015-07 |
一個大體的版本對應關係
date | mono version | net version | note |
---|---|---|---|
2008-10-01 | mono 2.0 | .net 2.0 c# 3.0 | |
2011-12-19 | mono 2.10.8 | .net 4.0 c# 4.0 | |
2014-03-31 | mono 3.4 | .net 4.5 c#5.0 | |
2016-06-08 | mono 4.4.0 | .net 4.6.1 c#6.0 |
mono編譯器版本升級 mono運行庫沒有升級,目前運行時的mono仍是 3.5
Date(時間) | Version(版本) | Note(備註) |
---|---|---|
2004-06-30 | 1.0 | C# 1.0 support |
2006-11-09 | 1.2 | C# 2.0 support |
2008-10-06 | 2.0 | .Net 2.0 C# 3.0 |
2010-09-22 | 2.8 | .Net profile C#4.0 support |
2012-10-15 | 3.0 | C# 5.0 support,async base class libray,MVC4 partial |
2014-03-31 | 3.4 | |
2015-04-29 | 4.0 | .NET 4.5 profile .NET4.5 assembiles,C#6.0,integrate .net core code |
2014-03-31 | 4.2 | |
2016-06-08 | 4.4 | |
2016-08-01 | 4.6 |
2016 Mono joins the .NET Foundation
參考資料
Mono release: http://www.mono-project.com/docs/about-mono/releases/
Mono 4.4:http://www.mono-project.com/docs/about-mono/releases/4.4.0/
Mono software: https://en.wikipedia.org/wiki/Mono_(software)
Unity Version | Mono Runtime/Compiler Version | Note |
---|---|---|
3.5 | ||
4.0 | 引擎大版本升級 | |
4.3 | 新的2D工具,Sprite | |
4.6 | uGUI,IL2CPP | |
5.0 | 2.0/2.0 | shader,assetbundle重大改變 ,等等 |
5.3.5p8 | 2.0/4.4 | Mono編譯器升級運行時未升級,等等 |
5.4.0 f1 | 2.0/2.0 | 更多VR平臺支持,等等 |
擴展資料
http://blogs.unity3d.com/2016/04/01/unity-joins-the-net-foundation/
編譯器和運行時版本不匹配能夠正常執行?
mono project github: https://github.com/mono/mono
mono doc: http://www.mono-project.com/docs/
Mono英文百科:[https://en.wikipedia.org/wiki/Mono](https://en.wikipedia.org/wiki/Mono)
Mono中文百科:https://zh.wikipedia.org/wiki/Mono
[.NET Core與.NET Framework、Mono之間的關係](http://www.cnblogs.com/shanyou/p/4295163.html)
國內 Mono 相關文章彙總:http://www.cnblogs.com/shanyou/archive/2012/07/28/2612919.html