How to configure Oculus Quest in MRTK using the XR SDK pipeline
A Oculus Quest is required.
MRTK's support for the Oculus Quest comes via two different sources, Unity's XR pipeline and the Oculus Integration Unity package. The Oculus XRSDK Data Provider enables the use of both sources and must be used to use MRTK on the Oculus Quest.
The Unity's XR Pipeline enables the use of Oculus Touch controllers and head tracking with the Oculus Quest. This pipeline is the standard for developing XR applications in Unity 2019.3 and beyond. To use this pipeline, make sure that you using Unity 2019.3 or newer.
The Oculus Integration Unity package allows for the use of hand tracking with the Oculus Quest. This data provider does NOT use Unity's XR Pipeline or Legacy XR Pipeline, but because controllers and headtracking are handled by the Unity's XR Pipeline, the steps in Setting up project for the Oculus Quest must be followed to ensure that you are using the XR Pipeline and not the to-be-deprecated Legacy XR Pipeline.
Setting up project for the Oculus Quest
Follow these steps to ensure that your project is ready to deploy on Oculus Quest.
Ensure that developer mode is enabled on your device. Installing the Oculus ADB Drivers is optional.
Setting up the XR Pipeline for Oculus Quest
Ensure that the Oculus XR Plugin is installed under Window --> Package Manager
Make sure that the Oculus Plug-in Provider is included in your project by going to Edit --> Project Settings --> XR Plug-in Management --> Plug-in Providers
Setting up the Oculus Integration Unity package to enable handtracking
Navigate to Mixed Reality Toolkit > Utilities > Oculus > Integrate Oculus Integration Unity Modules. Doing this will update the asmdefs with definitions and references needed for the relevant Oculus Quest code to function. It will also update the csc file to filter out the obsolete warnings produced by the Oculus Integration assets. The MRTK repo contains a csc file that converts warnings to errors, this conversion halts the MRTK-Quest configuration process.
In the imported Oculus folder (It should be found at Assets/Oculus), there is a scriptable object called OculusProjectConfig. In that config file, you need to set HandTrackingSupport to "Controllers and Hands".
Setting up the scene
- Create a new Unity scene or open a pre-existing scene like HandInteractionExamples
- Add MRTK to the scene by navigating to Mixed Reality Toolkit > Add to Scene and Configure
Using the Oculus XR SDK Data Provider
Configure your profile to use the Oculus XR SDK Data Provider
If not intending to modify the configuration profiles
- Change your profile to DefaultXRSDKInputSystemProfile and go to Build and deploy your project to Oculus Quest
Otherwise follow the following:
- Select the MixedRealityToolkit game object in the hierarchy and select Copy and Customize to clone the default mixed reality profile.
- Select the Input Configuration Profile
- Select Clone in the input system profile to enable modification.
- Open the Input Data Providers section, select Add Data Provider at the top, and new data provider will be added at the end of the list. Open the new data provider and set the Type to Microsoft.MixedReality.Toolkit.XRSDK.Oculus > OculusXRSDKDeviceManager
The Oculus XR SDK Data Provider includes an OVR Camera Rig Prefab which automatically configures the project with an OVR Camera Rig and OVR Hands to properly route input. Manually adding an OVR Camera Rig to the scene will require manual configuration of settings and input.
Build and deploy your project to Oculus Quest
Plug in your Oculus Quest via a USB 3.0 -> USB C cable
Navigate to File > Build Settings
Change the deployment to Android
Ensure that the Oculus Quest is selected as the applicable run device
Select Build and Run
- You will likely encounter the following set of build errors when you select Build and Run the first time. You should be able to successfully deploy upon selecting Build and Run again.
Accept the Allow USB Debugging prompt from inside the quest
See your scene inside the Oculus Quest
Removing Oculus Integration from the Project
- Navigate to the Mixed Reality Toolkit > Oculus > Separate Oculus Integration Unity Modules
- Let Unity refresh as references in the Microsoft.MixedReality.Toolkit.Providers.Oculus.asmdef and other files are modified in this step
- Close Unity
- Close Visual Studio, if it's open
- Open File Explorer and navigate to the root of the MRTK Unity project
- Delete the UnityProjectName/Library directory
- Delete the UnityProjectName/Assets/Oculus directory
- Delete the UnityProjectName/Assets/Oculus.meta file
- Reopen Unity
Quest not recognized by Unity
Make sure your Android paths are properly configured. If you continue to encounter problems, follow this guide
Edit > Preferences > External Tools > Android