- Home /
Add script to selection
Hey guys,
Is there a way to add the same script from the library to multiple objects in the editor at once?
I'm not talking about prefabs, these won't suit my needs.
Answer by Alex Leone · Apr 10, 2011 at 04:34 AM
To add script YourScript to a bunch of objects:
Select all the game objects you want to apply the script to
Go to Component->Scripts->Your Script
Tada!
Lemme know it that works for you. Worked for me.
Answer by Statement · Mar 28, 2011 at 01:57 PM
I am afraid you would need to make your own editor script for that. Perhaps check all gameObjects in the current Selection and apply some type to those. You'd probably have to use reflection (advanced) to list all the available component types as well. Perhaps you could start off with ReplaceSelection wizard and edit it to instead add a component? To make it easy you could just use a string when adding components instead of toying with reflection.