- Home /
How could I get a selection set of GameObject sharing a material or a script in Editor?
Materials and scripts could be referred as components. Should I write an editor script searching through every component of every gameObject collecting them, or is there a built-in function? Or should I put them onto layers at the beginning?
Answer by Jesse Anders · Dec 20, 2010 at 06:47 PM
Materials and scripts could be referred as components.
Not sure what you mean by that, but you should be able to do what you're wanting using an editor script, I think. For materials, you'd probably need to iterate over all renderers to see which ones reference the specified material, and for scripts, you'd simply need to find all game objects that included the specified script. (There's a function called FindObjectsOfType() or something of that sort that you should be able to use to return all renderers or components of a specified script type.)
Your answer
Follow this Question
Related Questions
saving scene and game objects 1 Answer
All instance of a script and change a variable 1 Answer
find object in game view 1 Answer
End game then an Object is close to another object? 0 Answers
Can't destroy a script. 1 Answer