In this lesson, you will learn how to use parent-child hierarchies to transform entire groups of GameObjects by manipulating only the parent object.
Understanding Transform Inheritance
When you place a GameObject inside another in the Hierarchy, the inner object becomes a "child" of the outer "parent." Because every GameObject has a Transform component, child objects inherit the spatial properties of their parent. If you move, rotate, or scale the parent, the child objects move, rotate, or scale right along with it, maintaining their relative offsets.
Practical Application: The "Furniture Set" Example
Imagine you are building a dining room scene. You have a Table object, and on top of it, you have four Chair objects and a TableLamp object.
If you want to move the entire dining set to a different corner of the room, you don't need to move each piece individually. Instead, you create an empty GameObject named DiningSet_Group and drag the Table, Chairs, and TableLamp into it.
Now, when you select DiningSet_Group and use the Move Tool (W) or Rotate Tool (E), the entire assembly acts as a single unit. Because the children inherit the Transform data, they stay locked in their positions relative to the parent regardless of where you drag the group.
The Inspector Perspective
You can see this in action by looking at the Transform component of a child object. Notice the values for Position, Rotation, and Scale change based on the parent's location. If the parent is moved to position (10, 0, 10), the child’s position is calculated relative to that parent’s point in space rather than the world origin (0, 0, 0).
// Example: Moving a parent moves all children automatically.
// By changing the parent's transform, the child hierarchy follows.
parentObject.transform.position = new Vector3(5, 0, 5);
By leveraging this inheritance, you avoid tedious manual adjustments and keep your scene organized, making it much easier to manage complex groups of objects as you refine your game layout.
Key Takeaway: Parent objects act as control handles for their children; changing the parent's Transform automatically updates the spatial properties of every object in its hierarchy.