Inputclass
Allows querying of player button presses and other inputs.
Methods22
Showing 22 methods
public static void Clear(string action)
Remove this action, so it's no longer being pressed.
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
void—public static void ClearActions()
Clears the current input actions, so that none of them are active.
void—public static bool Down(string action, bool complainOnMissing = True)
Action is currently pressed down
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
| complainOnMissing = True | bool | — |
bool—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)
| Parameter | Type | Description |
|---|---|---|
| analog | InputAnalog | — |
float—public static string GetGroupName(string action)
Finds the `Sandbox.InputAction.GroupName` of the given action.
| Parameter | Type | Description |
|---|---|---|
| action | string | Action name to find the group name of. |
string—public static bool Pressed(string action)
Action wasn't pressed but now it is
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
bool—public static void ReleaseAction(string name)
Releases the action, and it won't be active again until it's pressed again.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
void—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.
void—public static bool Released(string action)
Action was pressed but now it isn't
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
bool—public static void SetAction(string action, bool down)
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
| down | bool | — |
void—public static void StopAllHaptics()
Stop all vibration events on the current controller.
void—No results match this filter.
Properties13
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.
IEnumerable<string>—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?
int—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.
bool—public static bool Sandbox.Input.EscapePressed { get; set; }
True if escape was pressed
bool—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)
bool—public static bool Sandbox.Input.Suppressed { get; set; }
If the input is suppressed then everything will act like there is no input
bool—public static bool Sandbox.Input.UsingController { get; set; }
Was the last button pressed a game controller button?
bool—No results match this filter.