# Selecting Objects to Prefab Unity

So... I have a tree object and I have duplicated it to have many trees in the scene. So, I have about 200 trees in the scene. Before duplicating I forgot to add a tree as a prefab. Now, is there anyway to add a tree as prefab and make the other trees behave similarly.

Any Help would be appreciated. Thanks in Advance!!

• This is the best that I could find. I tested it but it seems to completely replace the old object like the position, so I'm not sure if it's helpful. Sep 27 '15 at 7:42
• I think the only way to edit all of them is to select them all and make change in the Inspector which will be applied to all of them. It works fine with changing values and adding components I believe. Sep 27 '15 at 12:49

Someone created a script for that: you can found it here on GitHub.

I report it here for completeness:

 @MenuItem ("Tools/Revert to Prefab %r")
static function Revert() {
var selection = Selection.gameObjects;

if (selection.length > 0) {
for (var i : int = 0; i < selection.length; i++) {
EditorUtility.ResetGameObjectToPrefabState(selection[i]);
}
} else {
Debug.Log("Cannot revert to prefab - nothing selected");
}
}


I have never used that, but I hope that you can find it useful.

• Thank You for that. I actually already set up components for them individually. :P Oct 1 '15 at 9:18
• OK! I hope that, keeping it here, it could also help others! ;) Oct 1 '15 at 9:47