How can we make a menu appear by pressing the Menu (Hamburger) button of the Quest Controller in a Scene? Please help its urgent.
I have a scene with a Mars planet theme and when we build that scene and enter in the scene then when I click the menu button I need to make the menu of my project appear. What I tried is :
public class Menu: MonoBehaviour
{
public GameObject mainMenu;
public GameObject createObject, createScript;
void Update()
{
OVRInput.Update();
bool isPressedButton = OVRInput.Get(OVRInput.Button.One);
if(isPressedButton)
{
Debug.Log(“Button A is pressed”);
MainMenuOption();
}
}
public void MainMenuOption()
{
mainMenu.SetActive(true);
}
}
What I tried I this: (for now I tried with the X button. I have attached a picture below to show what I have in the scene.
I think the Oculus button (if that is what you mean by hamburger button), is reserved and I think we wont be able to get that input within Unity. It is a “reserved” button.
See https://developer.oculus.com/documentation/unity/unity-ovrinput/ for more details.
But as you have it in your code, you can use the other buttons in the controller.
What I mean from the Menu button (Button. Start) is the one I have marked in the picture attached. Not the Oculus Home button but the Menu button in the left controller.
Also, what I pasted in my code, I tried that and it’s not working, I don’t know what’s wrong.
Can anyone suggest?
Thank you.
It would be also helpful if someone can say if, in one empty scene, we can press the button of the Quest controller can we make something appear without having any game objects, UI buttons, or anything? Is it possible?
Yes, you can definitely do this. I don’t know why it’s not working for you either. Check your assumptions and debug your project: is the problem in detecting the button press, or in presenting the menu where you can see it? Separate these steps to find out.
Thank you for your reply. I am new to this Unity and working now on my College project. Can you suggest any video or anything that would help in this matter?
A little bit late but for anyone still scratching their head, at the time of writing (Unity 2021.2) you can read the menu button input using KeyCode.JoystickButton6.
The Input System can’t send or receive from this button, even when using the ‘Listen’ feature (at least in the Editor).