Unity3D: determine .Net (Mono) runtime version

Trabla: Unity3D: determine .Net (Mono) runtime version


Unity3D determine .Net ( Mono) runtime version tutorial


Solving:

Use following script:

using UnityEngine;
using System.Collections;

// For Type class
using System;
// For MethodInfo class
using System.Reflection;

public class DemoScript : MonoBehaviour {

// Use this for initialization
void Start () {

GetMonoRuntimeVersion();

}

// Update is called once per frame
void Update () {

}

void GetMonoRuntimeVersion(){

Type type = Type.GetType("Mono.Runtime");
if (type != null)
{                                          
MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (displayName != null)                   
Debug.Log(displayName.Invoke(null, null)); 
}

}

}


Unity3D determine .Net ( Mono) runtime version tutorial screenshot 1

Result:
Unity3D determine .Net ( Mono) runtime version tutorial screenshot 2





Based on Unity3d forum discussion:
http://answers.unity3d.com/questions/924021/what-is-the-version-of-net-in-unity-5.html
http://answers.unity3d.com/questions/259448/how-to-determine-mono-version-of-unity-.html

No comments:

Post a Comment