- Home /
how do I find components through variable
I've tried searching but can't quite find the answer.. I've found all gameobjects in my scene, and iterated through them to find all of there components, the problem I'm running into now is that I need the value of all of the components, so I am trying to do;
foundComponents = GameObject.Find (myComponent.name).GetComponent("myComponent") as myComponents; // This is what I want but its not working Like I think it would
or
foundComponents = saveGameObject.myComponent; // This is what I want but its not working Like I think it would
Anyone have any idea to search through a list of found components and get their values?
Answer by DaveA · Jan 08, 2013 at 05:04 AM
Get the Component Copier from the Asset Store. The price is worth the lessons you'll learn from it, and it's a great tool to have anyway. Hint: Reflection