How to detect a/b/x/y button press on oculus quest 2

I tried using InputActionProperty and selecting the binding buttons from specyfic controllers in inspector:

[SerializeField] private InputActionProperty AButtonAction;
[SerializeField] private InputActionProperty BButtonAction;
[SerializeField] private InputActionProperty XButtonAction;
[SerializeField] private InputActionProperty YButtonAction;

but it didn’t work and I have no idea how to do it. i tried googling it but that didn’t help.

1 Like

Whats your code look like?

Did you subscribe to them like this? I am using a InputActionReference here though.

private InputActionReference openMenuInputLeftHand, openMenuInputRightHand;

private void Start()
{
    openMenuInputLeftHand.action.Enable();
    openMenuInputRightHand.action.Enable();
    openMenuInputLeftHand.GetInputAction().performed += x => ToggleInventoryAtController();
    openMenuInputRightHand.GetInputAction().performed += x => ToggleInventoryAtController();
}

i created the actions in the action map with action type = button.

for A and X, i use: path = “primaryButton[RightHand XR Controller]” (or left)
for B and Y, i use: path = “secondaryButton[RightHand XR Controller]” (or left)

I also use InputActionReference in script rather than property.
subscribing to myInputActionRef.action.started should listen for on press
subscribing to myInputActionRef.action.cancel should listen for on release
not sure about myInputActionRef.action.performed, i usually use those for continuous inputs and not binary buttons.

8743077--1184157--upload_2023-1-19_21-24-56.png

8743077--1184151--upload_2023-1-19_21-23-47.png

8743077--1184154--upload_2023-1-19_21-24-39.png

8743077--1184157--upload_2023-1-19_21-24-56.png

1 Like