public static abstract sealed class Sandbox.Input
Allows querying of player button presses and other inputs.
Related Guides
Broader workflow and conceptual references connected to this API.
Just like Subgraphs, you can also create your own custom Nodes with C# (and shader code) to be used in Shader Graphs.
There are various interfaces that can be given to components for specific purposes.
Some Input methods are specific to Controllers/Gamepads, and are useful to know for making sure your player experience caters to those who don't play on a Keyboard + Mouse.
You can broadcast and listen to events in your scene using interfaces.
Input glyphs are an easy way to show users which buttons to press for actions, they automatically adjust for whatever device you're using and return appropriate textures.
Input is accessed using the… Input class!
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.
No results match this filter.
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 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?
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.Input |