- Home /
How should I structure this in Unity?
Let's say I have have three models/prefabs:
Tank Body
Treads
Gun
Each one has a script attached, controlling its behavior depending on its type.
I want to be able to mix different body types, with different tread types, with different gun types. So, each one is a prefab. In my Hierarchy, I would create an empty gameobject, and assign these as children in this way:
Tank GameObject--->Treads ------>Tank Body -------->Gun
I have to parent these this way, because the treads turn the body, which turns the gun.
So this all works great, until I want to duplicate this for my scene . When I ctrl-D in the Hierarchy, or copy/paste, I only get this:
Tank GameObject ---->Treads
This is a bit of a pain if I want to put a lot of tanks on my scene...I have to recreate each one. I understand why this happens, but is there any way
- To have Unity not attempt to reestablish prefab links when copying, or
- Have Prefabs which can contain children more than one level deep?
Answer by dhendrix · Apr 29, 2010 at 02:38 PM
The prefabs should go beyond one level deep. It will only show one level in the project window but the children are really still there, and it should show the real hierarchy in the Hierarchy window when it is instantiated.
Your answer
Follow this Question
Related Questions
Duplicate prefab and all its variants to new prefab with new variants 0 Answers
Placing Prefabs in Prefabs. 9 Answers
Possible Unity Glitch. A few lines of code erasing prefab data. 1 Answer
What process should I best use to properly create an updated copy of a Prefab? 1 Answer
Creating Prefab causes scripts to break, Copy/Paste Gameobject doesn't 0 Answers