# [No coding] Prefabs and Parenting

Information
Step 1
In this lesson we'll learn about Parenting in the Hierarchy and how to save Parented items into Prefabs!
Step 2
Create 4 cubes, position them in a stack.
Step 3
Parent the cubes together one by one from top to bottom.
Step 4
Rename all 4 cubes as Parent, Child1, Child2, Child3
Step 5
Try clicking and dragging the cubes from top to bottom in the Scene!

After you finished playing with re-positioning the parented cubes, press CTRL+Z to undo until it's back to being a straight stack for the next step.

Information
Step 6
Let's see how this works...

"Parent" Is the parent of Child 1, Child 2, Child 3.
"Child 1" is the parent of Child 2 and Child 3
"Child 2" is the parent of Child 3
"Child 3" is only a child with no children attached.

So if you move Parent, you move all 3 childs.
If you move Child 1, you move child 2 and 3 too.
If you move child 2, you also move child 3.

Step 7
Let's try that again but this time we'll rotate it instead of re-positioning it.

After you played with rotating the parented Cubes. Press CTRL+Z to undo all of it for the next step.

Step 8
This time use the resize by edge tool and do the same experiment.
Information
Step 9
I don't recommend this but it will look very funny if you rotated and then resized it...
Step 10
Create colored Materials and color your 4 cubes.
Step 11
Click and drag your Parent cube object into the project panel to create a prefab.
Step 12
With this prefab we can use this "Copy" of the Parent cube any time we want! With the same colors and children.

Every "Copy" (Prefab) of the parent cube has the same color and the same Child1,2 and 3.

Step 13
When you want to save a custom object as a prefab, it's best to create an empty object as the Master Parent.

Remember to give it a name! You don't want your own custom objects to just be called "Game Object"!

Then select all your objects and click and drag into your empty game object.

HINT: Click the beginning object, HOLD SHIFT and then click the ending object to select all objects between.

Step 14
Lastly click and drag your empty game object into the project to save it as a prefab.
Step 15
Check to see if you can re-use this prefab by clicking and dragging it into the Hierarchy or the Scene!
Step 16
You're finished with this lesson! Click submit and go onto the next lesson!
[No coding] Prefabs and Parenting Info

Account

MVCode Clubs

Created By

Course:

[No coding] Unity Intermediate

Access Level