Skip to main content

InputToActionMapping

A class in Root.Township, the global namespace.

One binding from a VR input or keyboard key (with an optional second input) to a controller action, for one or both hands.

Constructors​

MemberWhat it is
InputToActionMapping()Creates an InputToActionMapping with default values.

Fields​

10 private and internal fields
MemberWhat it is
private ControllerActionType actionBacking field for Action.
private int dpadDirectionDpad direction for locomotion and swipe inputs, -1 when unused.
private InputToActionMapping.HandType handBacking field for Hand.
private int identifierBacking field for Identifier.
private bool isUsingSecondaryInputHidden inspector flag for whether a second input is used.
private static Logger loggerNLog logger for this class.
private GeneralInputType primaryInputMain VR input.
private KeyCode primaryInputKeyboardMain keyboard key, used before primaryInput on desktop modes.
private GeneralInputType secondaryInputSecond VR input.
private KeyCode secondaryInputKeyboardSecond keyboard key.

Properties​

MemberWhat it is
ControllerActionType Action { get; }The controller action this input triggers.
InputToActionMapping.HandType Hand { get; }Which hand the binding applies to.
int Identifier { get; }Random id given on creation.

Methods​

MemberWhat it is
override bool Equals(object obj)True when the action, inputs, keys, hand and dpad direction all match.
object[] GetButtonsForPlatform(PlayerMode platform)Returns the primary and secondary input for the given player mode, or null if the primary is none.
override int GetHashCode()Hash of all binding fields, including the random identifier.
override string ToString()The action name and its key or input names.
1 private and internal method
MemberWhat it is
private void SetupXRInput(object[] buttons)Fills the button pair for XR modes; locomotion and swipe inputs use the dpad direction as the second value.

Used in​

Members of other types that take, return or hold a InputToActionMapping: