Setting up your project
A step-by-step walkthrough of setting up a basic Unity Project for VR headsets
Last updated
A step-by-step walkthrough of setting up a basic Unity Project for VR headsets
Last updated
These instructions were written for Unity version 2022.3.4f1. They may not work for future versions.
In Unity Hub create a new project with the 3D (URP) template. Give it a name and choose its locations.
Go to the menu item Window > Package Manager
Under Features install:
VR (2 packages)
After installing you will be prompted with a warning: "Do you want to enable the backends?" Click "Yes"
Under Packages install:
XR Interaction Toolkit
XR Plugin Management (This should already be installed with VR Features)
A second dialog titled "XR InteractionLayerMask Update Required" will pop up. Click "I Made a Backup, Go Ahead!"
Before closing the Package Manager window, go to the XR Interaction Toolkit package and click on the Samples tab. Import Starter Assets.
Go to the menu item Edit > Project Settings
Under XR Plug-in Management, click the Android tab. Check the box for OpenXR
Under XR Plug-in Management > OpenXR
Click the "+" under Interaction Profiles to add a new profile for your device:
Quest 2 > Oculus Touch Controller Profile
Quest Pro > Meta Quest Touch Pro Controller Profile
Under OpenXR Feature Groups, check the box for Meta Quest Support
Go to Player:. Change Company and Product Name. Avoid spaces and symbols.
These instructions are for Mac development.
Go to File > Build Settings. Under Platform choose Android.
Click the button "Switch Platform"
Connect your device to your computer via USB
Under Run Device click "Refresh" then choose your device from the List. You may need to click allow from within the device.
Click Add Open Scenes to include the SampleScene in the build.
Repeat the above for the RightHandController choosing the XRI Default Right Controller preset.
You can add models for physical controller to help show where they are in space by adding a mesh object or prefab object.
Unity provides generic controller objects for the left and right hand XR Interaction Toolkit > [VERSION] > Starter Assets > Prefabs > XR Origin Pieces > XR Controller Left (and Right). Meta provides 3D models of their physical controllers.
Add your model or prefab as a child of your LeftHandController object. Make sure the nested models Transform position is set to (x: 0, y: 0, z: 0). If you add the object directly from the your Project Assets it should be positioned correctly.
After nesting your model in the LeftHandController object, select the LeftHandController and in the inspector find the section labeled Model in the XR Controller component. Click and drag the controller model from the heirarchy into the drop down box labeled Model Prefab.
Repeat steps for the RightHandController.
Switch Packages from In Project to Unity Registry
Add an XR Origin by going to the Hierarchy add XR > XR Origin. NOTE: Do NOT select the XR > Device-based > XR Origin
The select the left hand controller objects inside the Camera Offset inside the XR Origin.
On the XR Controller (Action-based) component of the LeftHandController click the preset menu and choose: XRI Default Left Controller.