class Input

in global :: Sandbox

Allows querying of player button presses and other inputs.


public static int ControllerCount { get; }

How many controllers are active right now?

public static bool EnableVirtualCursor { get; set; }

Whether or not the Virtual Cursor should show when using a controller. Disable this to control the cursor manually.

public static float GetAnalog( InputAnalog analog )

An analog input, when fetched, is between -1 and 1 (0 being default)

public static IDisposable PlayerScope( int index )

Push a specific player scope to be active

public static bool UsingController { get; }

Was the last button pressed a game controller button?

public static bool EscapePressed { get; set; }

True if escape was pressed

public static bool Down( string action, bool complainOnMissing = True )

Action is currently pressed down

public static bool Pressed( string action )

Action wasn't pressed but now it is

public static bool Released( string action )

Action was pressed but now it isn't

public static void SetAction( string action, bool down )

🤡 Doc inheritance is not yet supported.

No summary.

public static void Clear( string action )

Remove this action, so it's no longer being pressed.

public static void ReleaseAction( string name )

Releases the action, and it won't be active again until it's pressed again.

public static IEnumerable<string> ActionNames { get; }

Names of all actions from the current game's input settings.

public static string GetGroupName( string action )

Finds the of the given action.

  • action Action name to find the group name of.

public static VRInput VR { get; }

Virtual Reality specific input data.

public static Vector2 MouseDelta { get; set; }

Movement delta from the mouse.

public static Vector2 MouseWheel { get; set; }

The state of the mouse wheel.

public static bool MouseCursorVisible { get; }

True if the mouse cursor is visible (using UI etc)

public static Angles AnalogLook { get; set; }

Analog look value from the default input device. This is scaled by Preferences.Sensitivity - so you don't need to scale it afterwards.

public static Vector3 AnalogMove { get; set; }

Analog move value from the default input device.

public static InputMotionData MotionData { get; }

Current state of the current input device's motion sensor(s) if supported. This is only supported on: Dualshock 4+, Switch Controllers, Steam Controller, Steam Deck.

public static string GetButtonOrigin( string name, bool ignoreController = False )

Returns the name of a key bound to this InputAction For example: Input.GetButtonOrigin( "Undo" ) could return SPACE if using keyboard or A Button when using a controller.

public static Texture GetGlyph( string name, InputGlyphSize size = Small, bool outline = False )

Get a glyph texture from the controller bound to the action. If no binding is found will return an 'UNBOUND' glyph.

Remarks: You should update your UI with this every frame, it's very cheap to call and context can change.

public static Texture GetGlyph( string name, InputGlyphSize size = Small, GlyphStyle style = null )

🤡 Doc inheritance is not yet supported.

No summary.

public static Texture GetGlyph( InputAnalog analog, InputGlyphSize size = Small, bool outline = False )

Get a glyph texture from an analog input on a controller.

public static string GetButtonOrigin( InputAnalog analog )

Returns the name of the analog axis bound to this . For example: Input.GetButtonOrigin( InputAnalog.Move ) could return Left Joystick

public static void TriggerHaptics( float leftMotor, float rightMotor, float leftTrigger = 0, float rightTrigger = 0, int duration = 500 )

Trigger a haptic event on supported controllers including Xbox trigger impulse rumble.

Remarks: SDL will translate these commands into haptic pulses that should work on all controller types.

  • leftMotor The speed of the left motor, between 0.0 and 1.0.
  • rightMotor The speed of the right motor, between 0.0 and 1.0.
  • leftTrigger (Xbox One controller only) The speed of the left trigger motor, between 0.0 and 1.0.
  • rightTrigger (Xbox One controller only) The speed of the right trigger motor, between 0.0 and 1.0.
  • duration How long (in milliseconds) should we apply this for?

public static void TriggerHaptics( HapticEffect pattern, float lengthScale = 1, float frequencyScale = 1, float amplitudeScale = 1 )

Trigger haptics based on a predefined . All s are normalized (start at 0, peak at 1).

  • pattern The pattern to use
  • lengthScale The amount to scale the pattern's length by.
  • frequencyScale The amount to scale the pattern's frequency by.
  • amplitudeScale The amount to scale the pattern's amplitude by.

public static void TriggerHaptics( HapticEffect pattern, float frequencyScale, float amplitudeScale )

Trigger haptics based on a predefined . All s are normalized (start at 0, peak at 1).

  • pattern The pattern to use
  • frequencyScale The amount to scale the pattern's frequency by.
  • amplitudeScale The amount to scale the pattern's amplitude by.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public static void StopAllHaptics( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public static void ClearActions( )

😔 No documentation found.

public static IEnumerable<InputAction> GetActions( )

😔 No documentation found.

public static void ReleaseActions( )

😔 No documentation found.