Loading lessons...
GameObject & Transform
GameObject & Transform
In Unity, a GameObject is the fundamental container representing any item in your game. A GameObject by itself has no visual look, physics, or custom logic. It is just an empty container.
The Transform Component
Every single GameObject in Unity is created with a Transform component. The Transform cannot be removed. It defines:
- Position: Where the object is in the world (X, Y, Z coordinates).
- Rotation: How the object is oriented (measured in degrees around X, Y, and Z axes).
- Scale: How large the object is relative to its default size.
Active vs Inactive State
You can turn GameObjects on or off in the Editor or via script:
- Active: The object is processed by the engine (rendered, updated, subject to physics).
- Inactive: The object is hidden and paused. Children of inactive parents are also considered inactive.
Parent-Child Relationships
You can group GameObjects hierarchically.
- A Parent object acts as a group leader. If you move, rotate, or scale a parent, all child objects move, rotate, and scale with it.
- A Child object's position, rotation, and scale in the Inspector are calculated locally relative to its parent, rather than relative to the global world origin.
TL;DR
- GameObjects are empty containers for features.
- Every GameObject has a non-removable Transform component.
- The Transform controls Position, Rotation, and Scale.
- Inactive GameObjects and their children are disabled.
- Child transforms are calculated relative to their parent's transform.