Duplicate a game object


I try to make a platform game with obstacle like a little wall. When my character will enter a trigger zone, I want it to follow a path with a special animation. To do this, I create two sphere (pos1 and pos2) with my object littleWall (The character will join the first, then the second with Vector3.MoveTowards). When I launch my game, it works greats.

Now, I want to put a second littleWall on its path. I tried to duplicate it but it doesn’t work. The first one works, but it stops at the second. I think it’s because the objects have the same name (littleWall, pos1 and pos2).

I tried to use the 2 spheres with GameObject.Find, transform.Find, tranform.FindChild …

This is my treeview :


How may I use this object multiple time.

Thanks for your reply


Drag your little wall into your project and it will turn blue, when it is blue it becomes a prefab of the original parent. With that you can multiply" it as many times as you want.

Instantiate(ThePrefabYouWantToInstance, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;