Space Cadet VR — Wrist Menu
Objective: Creating a wrist menu that can turn off subtitles and quit the game
Currently in my game there was no way to turn off subtitles or quit the game. In order to change this, I decided to create a wrist menu.
When our player presses the pause button on the controller, a menu on their left wrist will pop up.
Creating the Wrist Menu
On the left hand create a canvas. After you add the canvas add 3 buttons and position them above the left hand. Adjust the background and text color to your liking.
Interacting With the Buttons
Now we need a way to interact with the buttons. We can do this by making our right hand use a ray interactor instead of a direct interactor. I did this by creating another XR Origin. Then I deleted everything except the right controller and made it a child where the other right controller is.
Set the interaction layer mask on that controller to nothing so it can’t interact with objects. Now it should be able to interact with the UI.
Button Interactions
Let’s get the buttons working. I created a wrist menu script. The first thing I programmed was the quit and toggle subtitles button. Then when the button is pressed it calls their own method.
Activate Wrist Menu
The buttons are working but what about displaying the menu with a button press? I created a new input action and named it game inputs.
Then I mapped the left controller pause button to the pause action.
Then I generated a C# class of Game Inputs so I can start scripting with it.
After initializing the input, I made sure the pause_performed method would be called when the pause button is pressed. Then I created the DisplayWristMenu method. This method vibrates your controller and turns on the wrist menu as well as the controller with the ray interactor.
Now are wrist menu is working.
Thanks for reading! If you want to play my VR game click here Space Cadet VR by JokingJester1 (itch.io)