Avoid hardcoded KeyCode-style habits for anything player-facing.
Input Guide
Use Input Map actions and event checks so controls survive remapping and ports.
🎮 Input System Guide
How Godot handles player input - coming from Unity
Events vs Polling
Godot offers two ways to handle input: event-based (reacting when input happens) and polling (checking input state each frame).
Event-Based: _input()
Called once when the input occurs. Best for:
- Button presses (jump, shoot, interact)
- Menu navigation
- Any "on press" action
func _input(event):
if event.is_action_pressed("jump"):
jump()
if event.is_action_pressed("shoot"):
fire_bullet()Polling: Input singleton
Check every frame. Best for:
- Continuous movement
- Held buttons
- Analog stick input
func _physics_process(delta):
if Input.is_action_pressed("move_right"):
position.x += speed * delta
if Input.is_action_pressed("sprint"):
speed = sprint_speed_input() is like Unity's OnButtonDown events, while Input.is_action_pressed() is like Input.GetKey().
Lock the pattern in
Before jumping to the next page, turn the idea into one tiny scene or script. That is where the Godot habit sticks.
Think of actions as named gameplay intent, not raw buttons.
Read actions with Input methods and keep movement in physics ticks.
Create actions for move, jump, attack, pause, and interact before writing controller code.