Game Objects and Components
This guide focuses on one thing: building objects with useful components.
The Core Model
In Sendama, gameplay objects are usually GameObject instances.
A game object typically includes:
- a
Transform(position, rotation, scale) - a
Renderer(visuals) - optional extra components (behavior, colliders, custom systems)
Create A Useful Object In The Editor
- open
Hierarchy - press
Shift+A - create
GameObject - rename it (example:
Player) - edit values in
Inspector
Minimum Component Setup
For a visible object, set at least:
- transform position
- renderer texture path
- renderer crop values when needed
For interactive objects, also add:
- behavior script component
- collider-related components where appropriate
Example: Player Object Metadata
[
'name' => 'Player',
'type' => 'GameObject',
'transform' => [
'position' => ['x' => 8, 'y' => 20],
'rotation' => ['x' => 0, 'y' => 0],
'scale' => ['x' => 1, 'y' => 1],
],
'renderer' => [
'texture' => 'Textures/player.texture',
],
'components' => [
[
'type' => Sendama\MyGame\Scripts\PlayerController::class,
'data' => [
'speed' => 4.0,
],
],
],
]
Parent-Child Objects
Use hierarchy parenting for related pieces:
Playeras parentWeaponas child
This keeps relative movement and organization clean.
In Hierarchy, drag one object onto another to parent it.
Good Naming Patterns
Use intent-based names:
PlayerEnemySpawnerExitDoorScoreLabel
Avoid placeholder names like Object1.
Checkpoint
Before moving on, confirm:
- your object is visible in scene view
- component values appear in inspector
- scene saves and reloads without losing object data