Is it possible to change up a varriable by calling its name in runtime?
Example:
GameObject myGameObject;
String toEdit = "myGameObject";
void Start(){
GameObject(toEdit) = transform.GetChild(0);
}
Is it possible to change up a varriable by calling its name in runtime?
Example:
GameObject myGameObject;
String toEdit = "myGameObject";
void Start(){
GameObject(toEdit) = transform.GetChild(0);
}
You can make it work via reflection. Use google to find out how to do it.
I would strongly suggest not doing it this way, and using a helper method to map the string to the variable.
You can do this, using reflection. I would strongly suggest not doing it. But it is possible.
Google reflection to find how to do the job.