TypeUtility
This class provides functionality for getting Type by given type name presented by string.
Available methods
public static Type GetTypeByName(string name)
This method returns Type by given string name. If type wasn't found in assembly, it returns null.
Example:
private void InstantiateSystem()
{
var scriptType = TypeUtility.GetTypeByName(className);
if (scriptType != null)
{
// Create a new GameObject and add the script as a component
GameObject newObject = new GameObject(className);
newObject.AddComponent(scriptType);
AssetDatabase.Refresh();
}
}
Last updated