menu_bookDocumentation
Input System Overview: Button Queries, Analog Input, and Escape Override
The s&box Input class provides button queries, analog input, and escape key handling for gameplay.
Button Queries
CSHARP
protected override void OnUpdate()
{
if ( Input.Down( "jump" ) ) // Key is held down (case insensitive)
WorldPosition += Vector3.Forward * Time.Delta;
if ( Input.Pressed( "jump" ) ) // Key was just pressed this frame
Jump();
if ( Input.Released( "jump" ) ) // Key was just released this frame
EndJump();
}Analog Input
CSHARP
Input.AnalogMove // Joystick "move" Vector3 (or WASD)
Input.AnalogLook // Joystick "look" Vector3 (mouse look)Custom Keys
Configure input actions in Project Settings. Each action maps keyboard and gamepad codes to named actions.
Escape Key Override
By default, ESC shows the s&box pause menu. Override it:
CSHARP
protected override void OnUpdate()
{
if ( Input.EscapePressed )
{
Input.EscapePressed = false;
// Handle escape in your own menu system
}
}If you override escape, you're responsible for providing access to settings and the pause menu yourself.
Was this helpful?