Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

reference a class by string unity

using UnityEngine;
using System;

public string className;

public void AddClassToGameobject()
{
	gameObject.AddComponent(Type.GetType(className));
}
 
PREVIOUS NEXT
Tagged: #reference #class #string #unity
ADD COMMENT
Topic
Name
5+3 =