I am trying to set spesific variable via text information;
so I found this :
----------------
GameObject.Find(NameOfGameObject)
.GetComponent(NameOfComponent).GetType()
.GetField(NameOfVariable)
.SetValue(GameObject.Find(NameOfGameObject)
.GetComponent(NameOfComponent), ValueToSet);
----------------------------
this is a sigle line code, and the code work fine for any variable types,(just parse it)
but the question is how to assign GameObject by this way, I tried GameObject.Find(Value) but doesn't work.
Any help will be appreciated :)
↧