API reference
API reference
Select your platform
No SDKs available
No versions available

ControllerButtonsMapper Class

Extends MonoBehaviour
A utility class for mapping controller buttons easily.
// Instantiate a new button action
var buttonAction = new ControllerButtonsMapper.ButtonClickAction
{
    Title = "Spawn Object",
    Button = OVRInput.Button.PrimaryIndexTrigger,
    ButtonMode = ControllerButtonsMapper.ButtonClickAction.ButtonClickMode.OnButtonUp,
    Callback = new UnityEvent()
};

Properties

ButtonClickActions : List< ButtonClickAction >
[Get][Set]
A list of ButtonClickAction to trigger.
Signature
List<ButtonClickAction> ButtonClickActions

Inner Struct

ButtonClickAction Struct

A struct to consolidate all the options for a button action.
// Instantiate a new button action
var buttonAction = new ControllerButtonsMapper.ButtonClickAction
{
    Title = "Spawn Object",
    Button = OVRInput.Button.PrimaryIndexTrigger,
    ButtonMode = ControllerButtonsMapper.ButtonClickAction.ButtonClickMode.OnButtonUp,
    Callback = new UnityEvent()
};

Fields

Button : OVRInput.Button
Sets the button that will trigger the Callback when the ButtonMode is detected (usually ButtonMode.OnButtonUp).
Signature
OVRInput.Button Button
ButtonMode : ButtonClickMode
Button click type: OnButtonUp, OnButtonDown, and OnButton.
Use OnButtonUp to trigger the callback when the user releases the button.
Signature
ButtonClickMode ButtonMode
Callback : UnityEvent
Dispatches when Button matches the chosen ButtonMode.
Signature
UnityEvent Callback
Title : string
A title for this button action.
Signature
string Title

Inner Enum

ButtonClickMode Enum
Button click mode types.
OnButtonDown will trigger on the first frame when the button is down. OnButtonUp will trigger on the first frame when the user presses releases the button. OnButton triggers repeatedly when the user holds the button down.
Enumeration Constants
Member
OnButtonUp
OnButtonDown
OnButton