Week 1 Lab: Unity XR Setup and First Deployment
Lab Overview
In this lab you will set up a Unity project for XR development and deploy a basic interactive scene to the Meta Quest 2.
By the end of this lab you should be able to:
- create a Unity project configured for XR
- install and configure the XR Interaction Toolkit
- build and deploy to the Meta Quest 2
- test basic locomotion and object interaction on device
Requirements
- Unity 2022 LTS or later
- Android Build Support module installed
- Meta Quest 2 headset and USB-C cable
- Developer mode enabled on the Quest 2
Part 1: Create a New Unity Project
- Open Unity Hub.
- Click New Project.
- Select the 3D (URP) template.
- Name your project
XR_Week01. - Click Create Project.
Part 2: Install XR Packages
Enable XR Plugin Management
- Go to Edit > Project Settings.
- Select XR Plugin Management.
- Click Install XR Plugin Management if prompted.
- Under the Android tab, enable Oculus.
Install XR Interaction Toolkit
- Go to Window > Package Manager.
- Select Unity Registry from the dropdown.
- Search for XR Interaction Toolkit.
- Click Install.
- When prompted, import the Starter Assets sample.
Part 3: Configure Android Build Settings
- Go to File > Build Settings.
- Select Android and click Switch Platform.
- Click Player Settings.
- Under Other Settings:
- Set Minimum API Level to Android 10 (API 29)
- Set Target API Level to Automatic
- Under XR Plug-in Management > Oculus, enable:
- Quest 2
- Quest 3 (if available)
Part 4: Set Up the XR Scene
Add XR Origin
- Delete the default Main Camera.
- Right-click in the Hierarchy.
- Select XR > XR Origin (VR).
This adds the XR Origin, Camera Offset, Main Camera, and Left/Right Controller objects.
Add Locomotion System
- Right-click in the Hierarchy.
- Select XR > Locomotion System.
- Add a Teleportation Provider component to the Locomotion System object.
- Add a Snap Turn Provider component.
Add a Teleportation Area
- Create a Plane (3D Object > Plane).
- Scale it to fill your scene floor.
- Add a Teleportation Area component to the Plane.
Add an Interactive Object
- Create a Cube (3D Object > Cube).
- Position it at approximately (0, 0.5, 2).
- Add an XR Grab Interactable component.
- Add a Rigidbody component.
Part 5: Build and Deploy to Quest 2
Connect the headset
- Connect the Quest 2 to your computer via USB-C.
- Put on the headset and accept the Allow USB Debugging prompt.
Build and Run
- Go to File > Build Settings.
- Click Add Open Scenes.
- Click Build and Run.
- Choose a location to save the APK.
- Unity will build and install the app on the headset.
Part 6: Test on Device
Put on the headset and test:
- Can you look around freely?
- Can you teleport by pointing and pressing the trigger?
- Can you grab the cube?
- Does the cube respond to physics when released?
Troubleshooting
| Problem | Solution |
|---|---|
| Device not detected | Check USB debugging is enabled and cable is connected |
| Build fails | Check Android SDK and NDK are installed in Unity Hub |
| Controllers not tracked | Check Oculus plugin is enabled in XR Plugin Management |
| Scene is dark | Add a Directional Light to the scene |
Lab Deliverable
Before leaving the lab, show your tutor:
- a working XR scene deployed to the Quest 2
- functional teleportation
- at least one grabbable object
This contributes to Assessment 1: Continuous Lab Work.
Extension Task
If you finish early:
- Add a second interactive object with different physics properties
- Add a simple UI canvas to the scene
- Experiment with snap turn vs continuous turn settings