The GameObject is the container. Components are the parts that make the object render, collide, play audio, run code, or participate in other engine systems.
Why Components Exist
Components let one GameObject be built from small focused pieces.
Instead of making a special object type for every possible combination, you attach the capabilities you need.
For example:
- a
Sprite Rendererdraws a 2D sprite - a
Rigidbody2Dlets physics move an object - a
BoxCollider2Dgives an object a collision shape - an
AudioSourceplays sounds - a
Behaviourruns scene-attached PHP gameplay code
Each component has a narrow job.
Components in the Inspector
When you select a GameObject, the Inspector shows its components as stacked sections.
Each section belongs to one component.

In this example:
Transformgives the paddle position, rotation, and scaleRectangle Rendererdraws the paddle as a visible rectanglePaddleis a Behaviour component with game-specific input and movement settings
That is where you edit component fields such as:
- sprite or texture references
- physics settings
- Behaviour-exposed values
- enabled or disabled state
- object references
This is one of the main reasons the editor exists: it lets designers and developers tune component data without editing scene files by hand.
Components and Behaviours
A Behaviour is a component too.
Native components are built into the engine. A Behaviour is a PHP class you attach to a GameObject when that object needs project-specific gameplay logic.
That means a Behaviour can live beside native components and coordinate them.
For example, a PlayerController Behaviour might read input, then update a Rigidbody2D, a SpriteAnimation, and a weapon component attached to the same GameObject.
Not every PHP class in a project needs to be a Behaviour. Use plain PHP classes for helpers, calculations, data structures, and services that do not need GameObject ownership or Inspector fields. Use enums when a value has a clear set of named choices.
Good Component Thinking
A useful rule is: give each component one clear responsibility.
For example:
- movement logic belongs in a movement Behaviour
- weapon firing belongs in a weapon Behaviour
- collision shape belongs in a collider component
- rendering belongs in a renderer component
- damage formulas can live in a plain PHP class
That keeps GameObjects understandable when you return to them later.