If you're coming from Unity, Godot's node system might seem different at first. But once you understand it, you'll find it's incredibly elegant and flexible. Let's break down how it works.
The Core Concept: Everything is a Node
In Unity, you have GameObjects with Components. In Godot, you have Nodes arranged in a tree. Each node type has specific functionality built in—there's no separate concept of components.
Unity vs Godot Mental Model
Unity Approach:
├── GameObject "Player"
│ ├── Transform (always present)
│ ├── SpriteRenderer (component)
│ ├── Rigidbody2D (component)
│ ├── Collider2D (component)
│ └── PlayerController (script)
Godot Approach:
├── CharacterBody2D "Player" (has physics built in)
│ ├── Sprite2D (child node)
│ ├── CollisionShape2D (child node)
│ └── Script attached to PlayerThe Scene Tree
Godot's scene tree is hierarchical. Nodes can have children, and transforms are inherited. Moving a parent moves all its children—just like Unity's hierarchy.
Common Node Types
Here are the most common nodes you'll use, with their Unity equivalents:
2D Nodes:
- Node2D → Transform only
- Sprite2D → SpriteRenderer
- CharacterBody2D → Character with CharacterController
- RigidBody2D → Rigidbody2D
- Area2D → Trigger Collider
- AnimationPlayer → Animator
3D Nodes:
- Node3D → Transform only
- MeshInstance3D → MeshRenderer
- CharacterBody3D → Character with CharacterController
UI Nodes:
- Control → RectTransform
- Label → Text/TextMeshPro
- Button → UI Button
- TextureRect → RawImageScenes as Prefabs
In Godot, a 'scene' is just a collection of nodes saved to a file. You can instance scenes inside other scenes—this is exactly like Unity prefabs. In fact, it's more powerful because scenes can contain their own scripts, resources, and nested scenes.
Key Takeaways
1. Nodes ARE the functionality (no separate components). 2. Composition through child nodes. 3. Scenes = reusable node hierarchies (like prefabs). 4. Scripts attach to nodes, not as separate components.
