- Home /
Turning Models/Meshes into Prefabs
Hello there.
I have two objects. One Fence Prefab and one Fence Mesh/Model. Obviously, I would usually use the prefab in my scene.
Now, I accidentally dropped the model into the scene, did not notice it, and multiplied it several hundred times. I wanted to change my prefab, but after changing, I noticed that all the fences in my scene are models and not prefabs. That is not really ideal.
Is there any way to turn the fence model into a prefab? I already tried dragging and dropping one of the fences from the Hierachy into the Project view, but that only made that one fence model into a prefab. All the other copies of that fence are still models.
I would really like to find a way to just turn the fence model used in the scene into a prefab, so I do not have to completely rebuild the scene...
Thanks in advance, I hope that it is somehow fixable.
My English is not the best, nor do I know how to explain this properly. If you have any questions, please feel free to ask.
Answer by iwaldrop · Apr 01, 2013 at 08:45 PM
There are some tools you could use out there, and you could also write your own simple script to do it.
Just do a foreach over all GameObjects that match your selected game object. Store it's Transform information, destroy the original, and instantiate the prefab in it's place.
Otherwise, if you can't find a 'replace all' tool, or can't write a simple (I'm talking like 10 line max) editor script that does it for you, then you'll have to do it by hand. Lesson learned, huh?
Yeh. I guess that will do. :) Did not think that of that simple solution. Thanks alot! And yes, definetly learned a lesson here. Already restructured my Project folders, so it wont happen agai