Skip to content

ButtonManager.cs

This script allows the user to bind events to the capacitive hardware buttons below the Looking Glass device.

If ButtonManager.cs is not attached to a Game Object, it will self-instantiate with default settings. To override, attach ButtonManager.cs to a Game Object and modify settings there.

For an example of how to use the Hardware Buttons, consult the "7 - Hardware Buttons" scene located in "Holoplay/Examples".

Fields

emulateWithKeyboard

Type: bool

If true (default), buttons can be emulated using 1/2/3/4 on alphanumeric keyboard.

Functions

GetButton(ButtonType button)

Returns: bool

Returns true while the button identified is held down.

if (ButtonManager.GetButton(ButtonType.SQUARE)) print("square is held");

GetButtonDown(ButtonType button)

Returns: bool

Returns true during the frame the user pressed down the button.

if (ButtonManager.GetButtonDown(ButtonType.SQUARE)) print("square was pressed");

GetButtonUp(ButtonType button)

Returns: bool

Returns true the first frame the user releases the button

if (ButtonManager.GetButtonDown(ButtonType.SQUARE)) print("square was released");

GetAnyButtonDown()

Returns: bool

Returns true the first frame the user releases the button

if (ButtonManager.GetAnyButtonDown()) print("a button was pressed");