InputManager
The InputManager maps player input to named actions. Your code asks “is jump held?” instead of “is the spacebar held?”, which lets you rebind devices and change input devices without touching gameplay code.
Open it from Inspector → Systems → InputManager → Open.
Schema
Section titled “Schema”| Field | What it does |
|---|---|
preset | Starting profile: platformer, topdown, fps, menu, or custom. Picks a sensible set of default actions. |
actions | List of named actions; each has a type and a list of bindings. |
deadzones.stick | Radial deadzone for analog sticks (0..1). Default 0.2. |
deadzones.trigger | Threshold for analog triggers (0..1). Default 0.05. |
Action types
Section titled “Action types”Each action has a type that determines how its bindings are interpreted:
button: pressed/held/released. Bindings: any digital input (key, mouse button, gamepad button).axis1d: scalar -1..1. Bindings: analog axes (left stick X, trigger), or pairs of keys (A/D as -1/+1).axis2d: vector (x, y). Bindings: analog sticks, mouse delta, or four keys (WASD).toggle: latched on/off. Each press flips state.
Bindings
Section titled “Bindings”Each binding has a device (keyboard, mouse, gamepad, touch) and a code (the key name or button index). Multiple bindings per action are fine; pressing any of them triggers the action.
A typical platformer action map:
| Action | Type | Bindings |
|---|---|---|
move | axis1d | keyboard KeyA/KeyD, gamepad left-stick X |
jump | button | keyboard Space, gamepad button A |
attack | button | keyboard KeyJ, mouse left, gamepad button X |
interact | button | keyboard KeyE, gamepad button B |
pause | button | keyboard Escape, gamepad Start |
Presets
Section titled “Presets”Picking a preset other than custom seeds the actions list with a sensible default. You can edit any preset’s actions after seeding; the preset choice doesn’t constrain you.
platformer: move (axis1d), jump, attack, interact, pause.topdown: move (axis2d), interact, attack, inventory, pause.fps: move (axis2d), look (axis2d, mouse), jump, primary, secondary, reload, pause.menu: navigate (axis2d), confirm, back. Minimal.custom: empty. Build the map from scratch.
Deadzones
Section titled “Deadzones”The stick deadzone is radial: it ignores stick input below the threshold magnitude (not per-axis). This is the right shape for stick movement; per-axis deadzones cause stair-step diagonals that feel terrible.
Trigger deadzone is a flat threshold (analog triggers don’t have a center; they’re 0..1).
Defaults are 0.2 for sticks and 0.05 for triggers. These match what most console games use. Increase the stick deadzone for older / drifty controllers; decrease it for precision-twitch games.
Common patterns
Section titled “Common patterns”Local multiplayer: define each action twice (p1_jump, p2_jump) with different bindings. The InputManager doesn’t track players explicitly; you partition by action name.
Rebinding UI: read the bindings list from gamemanager.toml at runtime; let the player edit; write back. The bundled SettingsManager’s controls category includes a rebinding scaffold.
Touch controls: bind touch device codes to on-screen virtual buttons. The bundles don’t ship touch controls but the system supports them.
Editing the config by hand
Section titled “Editing the config by hand”[systems.InputManager.config]preset = "platformer"
[systems.InputManager.config.deadzones] stick = 0.2 trigger = 0.05
[[systems.InputManager.config.actions]] name = "move" type = "axis1d" bindings = [ { device = "keyboard", code = "KeyA-KeyD" }, { device = "gamepad", code = "leftStickX" }, ]
[[systems.InputManager.config.actions]] name = "jump" type = "button" bindings = [ { device = "keyboard", code = "Space" }, { device = "gamepad", code = "A" }, ]Validation: action names are unique and match ^[a-z][a-z0-9_]*$. Deadzones must be 0..1.