using System;
using UnityEngine;
using UnityEngine;
public class Type_Test : MonoBehaviour
{
private void Awake()
{
/* 获取Type的三种方式 */
object compontent = new object();
{
private void Awake()
{
/* 获取Type的三种方式 */
object compontent = new object();
//<1> object.GetType();
Type type_A = compontent.GetType();
Type type_A = compontent.GetType();
//<2> typeof(object);
Type type_B = typeof(object);
Type type_B = typeof(object);
//<3> Type.GetType("");
Type type_C = Type.GetType("System.Object");
Type type_C = Type.GetType("System.Object");
//若GetType("")为null
//Type.GetType("namespace.class, namespace", false, false);
}
}
//Type.GetType("namespace.class, namespace", false, false);
}
}