Set Component property using a var
I want to do this:
Transform trans = gameObject.GetComponent<Transform>();
string propertyName = "position";
trans[propertyName] = new Vector3(0, 0, 0);
How can i do this part in c# trans[propertyName]
?
Comment
Your answer
Follow this Question
Related Questions
add variable to Instantiated objects then destroy it in another function 1 Answer
Programmmed Animation (making transform move to vectors with code) 0 Answers
Bullet destroy 2 game object intent one Unity 2D 0 Answers
Having trouble increasing level inside of Update() when score reaches 1000... 0 Answers