从Unity3D编译器升级聊起Mono

本文介绍了Unity3D的Mono编译器升级,探讨了Mono与.NET Framework的关系,以及它们在不同版本间的对应。内容包括Mono的运行机制、C#编译器、运行时、类库,以及Unity3D如何使用Mono版本。
摘要由CSDN通过智能技术生成

接前篇Unity 5.3.5p8 C#编译器升级,本文侧重了解一些Mono的知识。

Unity3D的编译器升级

新升级的Mono C#编译器(对应Mono 4.4)

Unity编辑器及播放器所使用的Mono运行时还未升级。

新编译器仍针对C# 4,是旧的编译器也支持的版本。

新编译器目标框架为.Net 3.5,也是之前支持的框架。

Mono是如何运行的?

  1. *.cs源文件通过编译器编译成IL(中间文件)

  2. IL 运行在Mono的 JIT(just in time)

  3. Mono虚拟机运行在物理机中

查看Unity使用的Mono版本

参考:http://answers.unity3d.com/questions/259448/how-to-determine-mono-version-of-unity-.html

我在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?    } }

方法二

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

Mono

Mono是.Net Framework?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值