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

  1. Open Unity Hub.
  2. Click New Project.
  3. Select the 3D (URP) template.
  4. Name your project XR_Week01.
  5. Click Create Project.

Part 2: Install XR Packages

Enable XR Plugin Management

  1. Go to Edit > Project Settings.
  2. Select XR Plugin Management.
  3. Click Install XR Plugin Management if prompted.
  4. Under the Android tab, enable Oculus.

Install XR Interaction Toolkit

  1. Go to Window > Package Manager.
  2. Select Unity Registry from the dropdown.
  3. Search for XR Interaction Toolkit.
  4. Click Install.
  5. When prompted, import the Starter Assets sample.

Part 3: Configure Android Build Settings

  1. Go to File > Build Settings.
  2. Select Android and click Switch Platform.
  3. Click Player Settings.
  4. Under Other Settings:
    • Set Minimum API Level to Android 10 (API 29)
    • Set Target API Level to Automatic
  5. Under XR Plug-in Management > Oculus, enable:
    • Quest 2
    • Quest 3 (if available)

Part 4: Set Up the XR Scene

Add XR Origin

  1. Delete the default Main Camera.
  2. Right-click in the Hierarchy.
  3. Select XR > XR Origin (VR).

This adds the XR Origin, Camera Offset, Main Camera, and Left/Right Controller objects.

Add Locomotion System

  1. Right-click in the Hierarchy.
  2. Select XR > Locomotion System.
  3. Add a Teleportation Provider component to the Locomotion System object.
  4. Add a Snap Turn Provider component.

Add a Teleportation Area

  1. Create a Plane (3D Object > Plane).
  2. Scale it to fill your scene floor.
  3. Add a Teleportation Area component to the Plane.

Add an Interactive Object

  1. Create a Cube (3D Object > Cube).
  2. Position it at approximately (0, 0.5, 2).
  3. Add an XR Grab Interactable component.
  4. Add a Rigidbody component.

Part 5: Build and Deploy to Quest 2

Connect the headset

  1. Connect the Quest 2 to your computer via USB-C.
  2. Put on the headset and accept the Allow USB Debugging prompt.

Build and Run

  1. Go to File > Build Settings.
  2. Click Add Open Scenes.
  3. Click Build and Run.
  4. Choose a location to save the APK.
  5. 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