run script as below:
Debug.Log(“System.IO.File=” + Type.GetType(“System.IO.File”));
Debug.Log(“UnityEngine.Animation=” + Type.GetType(“UnityEngine.UI.Image”));
Debug.Log(“UnityEngine.Animation=” + Type.GetType(“UnityEngine.Animation”));
the result is:
System.IO.File is null=False
UnityEngine.UI.Image is null=True
UnityEngine.Animation is null=True
so I can’t use script:
Type t = Type.GetType(“UnityEngine.UI.Image”); gameObject.AddComponent(t);
to add component to a gameobject ,
and in unity5 the gameObject.AddComponent(“UnityEngine.UI.Image”) is not allowed;
the reflection mechanism can’t be used.
I wish allow gameObject.AddComponent(“UnityEngine.UI.Image”) method in unity 5.