- Home /
how to replace multiple game objects with different transform component with same prefab?
I have about 150 walls and all are cubes. now i want them to be different instance of same prefab. Typically I have to drag & drop prefab from project menu to hierarchy and then copy and paste transform component on prefab and then delete cube. is there any better way?
If your walls are in a shape easy to describe mathematically (e.g. in a rectangular area), then writing an editor script for it can be faster.
Answer by tormentoarmagedoom · Apr 13, 2018 at 10:07 AM
Good day.
Check this post, and this post (Read the answers).
Combine what you learn there, (Instantiate() and GameObjectsWithTag() ) and using them you should be able to create a simple script to delete the old cubes, and instantiate the prefabs at desired position.
IF helped, accept the answer and close the question!
Bye!