TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
Input static class provides everything you need to read player input. Actions are defined as named strings (e.g. "Attack1", "Jump") so your code never references raw keycodes — the player can rebind anything.
Querying actions
Use these three methods to check the state of an action each frame. Call them insideOnUpdate or OnFixedUpdate.
Input queries return
false automatically when input is suppressed (e.g. while a UI element has focus), so you don’t need to guard against it yourself.Analog inputs
AnalogMove
Input.AnalogMove is a Vector3 built from the four directional actions (Forward, Backward, Left, Right). Use it as a movement direction in local space.
AnalogLook
Input.AnalogLook is an Angles value derived from mouse delta (and gamepad right stick). It is already scaled by the player’s sensitivity preference.
MouseDelta
Raw mouse movement in screen pixels since the last frame:MouseWheel
Scroll wheel input as aVector2 (y is the usual vertical scroll):
MouseCursorVisible
Check whether the cursor is currently visible (e.g. a menu is open):Programmatic input
You can force an action on or off from code:Default actions
When no custom input settings are defined, s&box provides these built-in actions:- Movement
- Actions
- Inventory
- Misc
| Action | Default key | Gamepad |
|---|---|---|
Forward | W | — |
Backward | S | — |
Left | A | — |
Right | D | — |
Jump | Space | A button |
Run | Shift | Left stick click |
Walk | Alt | — |
Duck | Ctrl | B button |
InputAction definitions
Define your game’s actions in Edit → Project Settings → Input. EachInputAction has:
| Field | Description |
|---|---|
Name | Identifier used in code, e.g. "Attack1" |
KeyboardCode | Default keyboard key/combo, e.g. "mouse1" |
GamepadCode | Mapped gamepad button |
GroupName | Category shown in the rebinding UI |
Title | Human-readable label, e.g. "Primary Attack" |
Querying bound keys
Get the current key name for an action — useful for button prompts in your HUD:Input contexts
Input contexts let different systems consume input independently. Each context has its ownActionsCurrent, ActionsPrevious, and mouse delta accumulators. This allows a menu system to intercept input without affecting gameplay input.