OpenXR: Oculus doesn't recognize menuButton in script

When using OpenXR with Oculus, the left menu button doesn’t register when I use in code:

controller.inputDevice.TryGetFeatureValue(CommonUsages.menuButton, out bool testVal);

testVal is always false even when I press the menu button.

It should work since:

  1. Every other buttons work just fine
  2. When using the Oculus Plugin, that line of code works fine
  3. When using OpenXR but with vive controllers, that line of code also works.

Can you please advise?

I too have also run into this bug. I ended up making a bug report:
https://fogbugz.unity3d.com/default.asp?1408385_rvq5ag2lb9n0hh9s

Hey,

Thanks for reporting this bug. We looked into it and have a fix for now. It will be included in our next OpenXR release soon. I can update this thread when next release is out, so you could try it out.

Thanks

1 Like

Update: The fix for this menu button issue was released in OpenXR SDK 1.4.1.

Hi, after upgrading to OpenXR SDK 1.4.1 it appears to have broken the ability to use path “{LeftHand}/{menu}” to recognise the menu button on oculus touch controllers. Is this a bug?

Edit: will mention that the specific bind “XRInputV1::Oculus::OculusTouchControllerOpenXR{LeftHand}/menu” works fine

Hey @lazylukey ,
It looks like your syntax may be a little off. Here are the 2 options

"<XRController>{LeftHand}/{menuButton}"
or
"<XRController>{LeftHand}/menu"

This is because {menuButton} is part of the usages list but menu is not. Let us know if either of these works for you or if you are still having problems.

I upgraded OpenXR to 1.4.1 and 1.4.2 and Oculus to 3.0.1 and 3.0.2 and am not getting anything from the menu button, if I set this same code’s action map to something like grip pressed it works. I am on Unity 2021.2.18f1 and an Oculus Quest 2. (Standalone, not Quest 2, building from Apple Silicon MacBook Pro). I tried so many different menu button options.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class MenuToggle : MonoBehaviour
{
[SerializeField] InputActionAsset inputActions;
InputAction menuToggle;
bool menuActive;
[SerializeField] GameObject menuPanel;

// Start is called before the first frame update
private void Start()
{
var inputActionMap = inputActions.FindActionMap(“XRI LeftHand Interaction”);
menuToggle = inputActionMap.FindAction(“Menu Toggle”);
menuToggle.performed += ToggleMenu;
menuToggle.Enable();
}

public void ToggleMenu(InputAction.CallbackContext context)
{
if (menuActive)
{
menuActive = false;
menuPanel.SetActive(false);
}
else
{
menuActive = true;
menuPanel.SetActive(true);
}
}
}

1 Like

Hi thanks for the reply, can confirm <XRController>{LeftHand}/menu does work OK, thanks! :slight_smile:

I have the same issue, the following line works for everything except CommonUsages.menuButton
Example:
targetDevice.TryGetFeatureValue(CommonUsages.menuButton, out bool menuBtn);

Just chiming in to say I’m also having this menu button problem. I just updated my OpenXR from 1.3.1 to to 1.4.2 hoping it would fix the issue, but it doesn’t seem to.

OK I’ve got it working now:
"<XRController>{LeftHand}/menu" Does NOT Work
"<XRController>{LeftHand}/{menuButton}" Works

But unfortunately, adding menuButton through the InputActions UI adds "<XRController>{LeftHand}/menuButton", which does NOT work. So you need to press the T and manually add the curly brackets

1 Like

@Tanya_Li this is still an issue if you are using the Oculus Android build setting with OpenXR, at least on Quest 2 anyway. It would be nice to get this fixed as I’d like to be able to use features such as Oculus hand tracking and passthrough AR. @HolovisionCB if you don’t need Oculus features, switch your Android setting to OpenXR, don’t use Oculus libraries.