Skip to content
smartargs
VantageDocumentation

Input reference

The input actions API: finding, installing, rebinding and labelling actions, blocking gameplay input, and the names of the shipped actions. For how to use it, see Input.

VtInput

Static class.

The Input System actions Vantage’s player input components read. The package ships Resources/VtInputActions with a Gameplay map: Select, Command, Confirm Target, Ability 1 to 10, Cancel, Attack Move, Stop, Hold Position, Control Group 1 to 10, Assign Modifier, Additive Modifier and Camera Snap Back, Rotate Placement and Rotate Placement Back, each bound for keyboard and mouse and, where it makes sense, gamepad. Components take an optional action reference per input; an empty reference uses the action of the same role from Actions.

Scripting API

Member Description
static InputActionAsset Actions { get; } The asset actions are read from: the one installed with SetActions, otherwise a runtime copy of the shipped asset, so rebinding never changes the asset file. Null when neither exists, which leaves every input unbound.
static int Version { get; } Increases whenever the asset or its bindings change. Components that cache actions compare it.
static string ActiveScheme { get; } The control scheme of the device the player used last: KeyboardMouseScheme until a gamepad button is pressed, then GamepadScheme until a key or the mouse is used again. Key labels read it to show the right glyphs.
static bool IsGameplayBlocked { get; } True while something, such as an open window or menu, holds the player’s input: hotkeys, orders, selection, control groups and click-to-move do nothing. Hold it with BlockGameplay.
static event Action OnBindingsChanged Fires after the asset or its bindings changed. Redraw key labels here.
static event Action OnActiveSchemeChanged Fires after ActiveScheme changed. Redraw key labels here.
const string ResourcePath Resources path of the shipped actions asset.
const string KeyboardMouseScheme Control scheme name for keyboard and mouse bindings.
const string GamepadScheme Control scheme name for gamepad bindings.
static void BlockGameplay(object owner) Hold the player’s gameplay input for owner until UnblockGameplay. Several owners can hold it at once; input returns when the last one lets go.
static void UnblockGameplay(object owner) Let go of the hold owner took with BlockGameplay.
static void SetActiveScheme(string scheme) Set ActiveScheme yourself, for a device switch your own code detects or a settings choice. Null or an unchanged scheme does nothing.
static void SetActions(InputActionAsset asset) Read actions from asset instead of the shipped one. Null goes back to the shipped asset.
static InputAction Find(string actionName) The action called actionName, such as Gameplay/Ability 1, enabled. Null when missing.
static InputAction Resolve(InputActionReference reference, string defaultName) The action of reference when set, otherwise Find of defaultName. The result is enabled.
static bool WasPressed(InputAction action) True on the frame action was pressed.
static bool WasReleased(InputAction action) True on the frame action was released.
static bool IsHeld(InputAction action) True while action is held.
static string DisplayString(InputAction action, string controlScheme = null) The binding of action as a short label such as “1”, “Esc” or “LB”. controlScheme limits it to KeyboardMouseScheme or GamepadScheme; null lists every binding.
static string SaveBindingOverrides() The player’s binding changes as JSON, for a settings file.
static void LoadBindingOverrides(string json) Apply binding changes saved with SaveBindingOverrides. Empty removes every change.
static void NotifyBindingsChanged() Tell components and key labels that bindings changed, after rebinding an action yourself.
static void ResetCache() Throw away the copy of the shipped asset with its bindings, forget any installed asset, release every gameplay block and go back to the keyboard scheme.

VtInputActionNames

Static class.

Names of the actions in the Vantage input actions asset. Pass them to VtInput.Find, or give your own asset actions with the same names before installing it with VtInput.SetActions.

Scripting API

Member Description
const int NumberedCount How many numbered ability and control group actions the asset has.
const string Select Selects units under the pointer and draws a selection box while held. Left mouse button.
const string Command Moves, attacks or picks up at the pointer, and cancels aiming, attack-move targeting or placing a building. Right mouse button.
const string ConfirmTarget Casts the ground ability being aimed, picks the attack-move point and places the building being placed. Left mouse button and the gamepad South button.
const string Cancel Stops aiming, stops attack-move targeting, stops placing a building and clears the selection. Escape and the gamepad East button.
const string RotatePlacement Turns the building being placed one step clockwise. R and the gamepad d-pad right.
const string RotatePlacementBack Turns the building being placed one step counter-clockwise. Shift + R and the gamepad d-pad left.
const string AttackMove Starts an attack-move. A.
const string Stop Stops the selected units. S.
const string HoldPosition Makes the selected units hold position. H.
const string AssignModifier Held with a control group action to save the selection as the group. Ctrl.
const string AdditiveModifier Held to add to the selection or to a control group, and to keep placing the same building. Shift.
const string CameraSnapBack Returns the camera to its target. Space and the right stick press.
static string Ability(int index) The ability action for slot index (0 is Ability 1), or null past the last one.
static string ControlGroup(int index) The control group action for group index (0 is Control Group 1), or null past the last one.