Interactive Lab Quest

Input Playground

See how pressed, just-pressed, and direction checks behave before using them in a controller.

10-20 min Practice first Godot 4.6

Godot Input Playground

Test how Godot 4 handles keyboard, mouse, and movement input in real time. Press WASD or the arrow keys, click the canvas, and see exactly what input events Godot would emit. The right panel shows the equivalent GDScript using Input.is_action_pressed() and InputEvent handlers, so you can copy the pattern straight into your project.

This interactive lab pairs with our complete Input System guide and is built for developers coming from Unity or Unreal, where input maps to Input.GetAxis() or Enhanced Input. In Godot you wire actions in Project Settings → Input Map, then read them every frame in _process or per-event in _input.

🎮

Live input testing canvas

Test Godot input handling live. Press WASD or Arrow keys!

⏸️ Idle
🚀
⌨️ WASD / Arrows to move • 🖱️ Click anywhere

⚡ Input State

W
A
S
D
Direction:
Velocity: (0.0, 0.0)
Mouse: (0, 0)

📝 GDScript

func _process(delta):
  var dir = Input.get_vector(
    "ui_left", "ui_right",
    "ui_up", "ui_down"
  )
  velocity = dir * SPEED
  move_and_slide()

📋 Event Log

Press a key to start...

What you can learn from this Godot input playground

  • Action map vs raw key codes: Godot's recommended pattern is to register named actions (e.g. move_left) in the Input Map and call Input.is_action_pressed("move_left"), instead of testing raw key codes.
  • Per-frame vs per-event: Use _process(delta) with Input.is_action_pressed() for held movement; use _input(event) for one-shot actions like jump or pause.
  • Just-pressed and just-released: Input.is_action_just_pressed() fires once on the first frame; useful for jump triggers and UI confirmations.
  • Mouse and touch as InputEvent: Mouse motion, mouse buttons, and touch all flow through the same InputEvent system — check the type with event is InputEventMouseButton.
  • Cross-platform parity: Define gamepad bindings alongside keyboard bindings on the same action so the same code works on PC, Steam Deck, and consoles.

Input handling FAQ for Godot 4

How do I check if a key is pressed in Godot 4?

Use Input.is_key_pressed(KEY_W) for raw keys, but the recommended approach is to register an action in Project Settings → Input Map, then call Input.is_action_pressed("action_name"). Action-based input keeps your code portable across keyboard, mouse, and gamepad.

What's the difference between _input, _unhandled_input, and _process?

_input(event) runs for every input event and fires before any node consumes it. _unhandled_input(event) runs only for events not consumed by UI. _process(delta) runs every frame regardless of input — use it with Input.is_action_pressed() to read held state.

How does Godot input compare to Unity's Input.GetAxis?

Godot's analog of Input.GetAxis("Horizontal") is Input.get_axis("move_left", "move_right"). It returns a float in the range -1 to 1, derived from the named actions you defined in the Input Map. Multiple keys and gamepad axes can map to the same action.

Can I rebind keys at runtime?

Yes. Use InputMap.action_erase_events("action_name") to clear and InputMap.action_add_event("action_name", new_event) to add a new binding. Persist user rebindings to a config file with ConfigFile or your save system.

Tutor Checkpoint

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.

Unity habit

Separate continuous input from one-frame button presses.

Unreal habit

Treat input events and held state as different tools.

Godot habit

Use is_action_pressed for held state and is_action_just_pressed for edges.

Try this

Press keys slowly and quickly, then predict which checks should light up.