s&box docs

public static abstract sealed class Sandbox.Input

Allows querying of player button presses and other inputs.

Broader workflow and conceptual references connected to this API.

Methods

Showing 21 methods

public static void Clear(string action)

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

public static void ClearActions()

Clears the current input actions, so that none of them are active.

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

Action is currently pressed down

Parameters

  • complainOnMissing: Default: True

public static System.Collections.Generic.IEnumerable`1<Sandbox.InputAction> GetActions()

Copies all input actions to be used publicly

public static float GetAnalog(Sandbox.InputAnalog analog)

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

public static string GetGroupName(string action)

Finds the `Sandbox.InputAction.GroupName` of the given action.

Parameters

  • action: Action name to find the group name of.

public static System.IDisposable PlayerScope(int index)

Push a specific player scope to be active

public static bool Pressed(string action)

Action wasn't pressed but now it is

public static void ReleaseAction(string name)

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

public static void ReleaseActions()

Clears the current input actions, so that none of them are active. Unlike ClearActions this will unpress the buttons, so they won't be active again until they're pressed again.

public static bool Released(string action)

Action was pressed but now it isn't

public static void SetAction(string action, bool down)

public static void StopAllHaptics()

Stop all vibration events on the current controller.

Properties

Showing 13 properties

public static System.Collections.Generic.IEnumerable`1<string> Sandbox.Input.ActionNames { get; set; }

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

public static Angles Sandbox.Input.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 Sandbox.Input.AnalogMove { get; set; }

Analog move value from the default input device.

public static int Sandbox.Input.ControllerCount { get; set; }

How many controllers are active right now?

public static bool Sandbox.Input.EnableVirtualCursor { get; set; }

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

public static bool Sandbox.Input.EscapePressed { get; set; }

True if escape was pressed

public static Sandbox.InputMotionData Sandbox.Input.MotionData { get; set; }

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 bool Sandbox.Input.MouseCursorVisible { get; set; }

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

public static Vector2 Sandbox.Input.MouseDelta { get; set; }

Movement delta from the mouse.

public static Vector2 Sandbox.Input.MouseWheel { get; set; }

The state of the mouse wheel.

public static bool Sandbox.Input.Suppressed { get; set; }

If the input is suppressed then everything will act like there is no input

public static bool Sandbox.Input.UsingController { get; set; }

Was the last button pressed a game controller button?

public static Sandbox.VR.VRInput Sandbox.Input.VR { get; set; }

Virtual Reality specific input data.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Input

On this page

Methodspublic static System.Void Clear(System.String action)public static System.Void ClearActions()public static System.Boolean Down(System.String action, System.Boolean complainOnMissing = True)public static System.Collections.Generic.IEnumerable`1<Sandbox.InputAction> GetActions()public static System.Single GetAnalog(Sandbox.InputAnalog analog)public static System.String GetButtonOrigin(Sandbox.InputAnalog analog)public static System.String GetButtonOrigin(System.String name, System.Boolean ignoreController = False)public static Sandbox.Texture GetGlyph(Sandbox.InputAnalog analog, Sandbox.InputGlyphSize size = 0, System.Boolean outline = False)public static Sandbox.Texture GetGlyph(System.String name, Sandbox.InputGlyphSize size = 0, Sandbox.GlyphStyle style = null)public static Sandbox.Texture GetGlyph(System.String name, Sandbox.InputGlyphSize size = 0, System.Boolean outline = False)public static System.String GetGroupName(System.String action)public static System.IDisposable PlayerScope(System.Int32 index)public static System.Boolean Pressed(System.String action)public static System.Void ReleaseAction(System.String name)public static System.Void ReleaseActions()public static System.Boolean Released(System.String action)public static System.Void SetAction(System.String action, System.Boolean down)public static System.Void StopAllHaptics()public static System.Void TriggerHaptics(Sandbox.HapticEffect pattern, System.Single lengthScale = 1, System.Single frequencyScale = 1, System.Single amplitudeScale = 1)public static System.Void TriggerHaptics(Sandbox.HapticEffect pattern, System.Single frequencyScale, System.Single amplitudeScale)public static System.Void TriggerHaptics(System.Single leftMotor, System.Single rightMotor, System.Single leftTrigger = 0, System.Single rightTrigger = 0, System.Int32 duration = 500)Propertiespublic static System.Collections.Generic.IEnumerable`1<System.String> Sandbox.Input.ActionNames { get; set; }public static Angles Sandbox.Input.AnalogLook { get; set; }public static Vector3 Sandbox.Input.AnalogMove { get; set; }public static System.Int32 Sandbox.Input.ControllerCount { get; set; }public static System.Boolean Sandbox.Input.EnableVirtualCursor { get; set; }public static System.Boolean Sandbox.Input.EscapePressed { get; set; }public static Sandbox.InputMotionData Sandbox.Input.MotionData { get; set; }public static System.Boolean Sandbox.Input.MouseCursorVisible { get; set; }public static Vector2 Sandbox.Input.MouseDelta { get; set; }public static Vector2 Sandbox.Input.MouseWheel { get; set; }public static System.Boolean Sandbox.Input.Suppressed { get; set; }public static System.Boolean Sandbox.Input.UsingController { get; set; }public static Sandbox.VR.VRInput Sandbox.Input.VR { get; set; }Metadata