VR with Andrew's Extras Tutorial: https://www.youtube.com/watch?v=50zTxsCpfgk

Basic Steps:
1. Set up an XR Rig (explained in Module 1: Setting up the XR Interaction Toolkit).
2. Create a UI Canvas (right click in the Hierarchy window and select XR -> UI Canvas).
* Note: The EventSystem that Unity automatically adds to the scene when you create a UI Canvas registers your controllers' interactions with canvas elements like buttons and sliders.
3. Scale down and reposition the Canvas via its Transform component.
4. Create a button as a Child object of the Canvas (right click the Canvas and select UI -> Button).
* Note: You could alternatively add a "Button - TextMeshPro" and Unity will open up a menu for importing the TextMeshPro package.
About TextMeshPro: "Powerful and easy to use, TextMesh Pro uses Advanced Text Rendering techniques along with a set of custom shaders; delivering substantial visual quality improvements while giving users incredible flexibility when it comes to text styling and texturing.

TextMesh Pro provides Improved Control over text formatting and layout with features like character, word, line and paragraph spacing, kerning, justified text, Links, over 30 Rich Text Tags available, support for Multi Font & Sprites, Custom Styles and more."
5. Rescale the button.
6. Make sure your controllers are set up with the "XR Ray Interactor" component.
7. Set up what event(s) you want the button's "On Click" function to trigger. (Learn more about button events in "Module 5: UI" in the Unity Modules section on this site.)
8. When you enter Play Mode, you should be able to interact with the button using whatever button is set as the "UI Press" parameter in your LeftHand and RightHand Controller objects' "XR Controller" components (set to the "Grip" by default).

Back to Top