Setting up your project

A step-by-step walkthrough of setting up a basic Unity Project for VR headsets

These instructions were written for Unity version 2022.3.4f1. They may not work for future versions.

Create new project

In Unity Hub create a new project with the 3D (URP) template. Give it a name and choose its locations.

Install packages

  1. Go to the menu item Window > Package Manager

  2. Switch Packages from In Project to Unity Registry

  3. Under Features install:

    • VR (2 packages)

  4. After installing you will be prompted with a warning: "Do you want to enable the backends?" Click "Yes"

  5. Under Packages install:

    • XR Interaction Toolkit

    • XR Plugin Management (This should already be installed with VR Features)

  6. A second dialog titled "XR InteractionLayerMask Update Required" will pop up. Click "I Made a Backup, Go Ahead!"

  7. Before closing the Package Manager window, go to the XR Interaction Toolkit package and click on the Samples tab. Import Starter Assets.

Edit project settings

  1. Go to the menu item Edit > Project Settings

  2. Under XR Plug-in Management, click the Android tab. Check the box for OpenXR

  3. 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

  4. Go to Player:. Change Company and Product Name. Avoid spaces and symbols.

Edit build settings

These instructions are for Mac development.

  1. Go to File > Build Settings. Under Platform choose Android.

  2. Click the button "Switch Platform"

  3. Connect your device to your computer via USB

  4. Under Run Device click "Refresh" then choose your device from the List. You may need to click allow from within the device.

  5. Click Add Open Scenes to include the SampleScene in the build.

Setting up the scene

Creating the XR Origin

  1. Add an XR Origin by going to the Hierarchy add XR > XR Origin. NOTE: Do NOT select the XR > Device-based > XR Origin

  2. The select the left hand controller objects inside the Camera Offset inside the XR Origin.

  3. On the XR Controller (Action-based) component of the LeftHandController click the preset menu and choose: XRI Default Left Controller.

  4. Repeat the above for the RightHandController choosing the XRI Default Right Controller preset.

Adding controller models

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.

  1. 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.

  2. 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.

  3. Repeat steps for the RightHandController.

Last updated