Oculus Unity

Posted on  by 



-->

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

Unity

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 inSetting 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

Oculus App Development in Unity Oculus provides SDK for the Unity development environment. Using the SDK, you can use key VR features such as user input, controllers, and rendering to build immersive VR experiences for Oculus devices. 50% off top assets and score extra savings with coupon code SPRING2021. We would like to show you a description here but the site won’t allow us.

  1. Follow these steps to ensure that your project is ready to deploy on Oculus Quest.

  2. Ensure that developer mode is enabled on your device. Installing the Oculus ADB Drivers is optional.

Setting up the XR Pipeline for Oculus Quest

  1. Ensure that the Oculus XR Plugin is installed under Window --> Package Manager

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

  1. Download and import Oculus Integration from the Unity Asset Store. The latest version tested towork is 20.0.0. Older versions can be found from this archive

  2. Navigate to Mixed Reality Toolkit > Utilities > Oculus > Integrate Oculus Integration Unity Modules. Doing this will update the asmdefs with definitions and references needed for therelevant 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.

  3. 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 HandTrackingSupportto 'Controllers and Hands'.

Setting up the scene

  1. Create a new Unity scene or open a pre-existing scene like HandInteractionExamples
  2. Add MRTK to the scene by navigating to Mixed Reality Toolkit > Add to Scene and Configure

Oculus Unity Setup

Using the Oculus XR SDK Data Provider

  1. Configure your profile to use the Oculus XR SDK Data Provider

    • If not intending to modify the configuration profiles

      • Change your profile to DefaultXRSDKConfigurationProfile 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
  2. 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

  1. Plug in your Oculus Quest via a USB 3.0 -> USB C cable

  2. Navigate to File > Build Settings

  3. Change the deployment to Android

  4. Ensure that the Oculus Quest is selected as the applicable run device

  5. 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.
  6. Accept the Allow USB Debugging prompt from inside the quest

  7. See your scene inside the Oculus Quest

Removing Oculus Integration from the Project

  1. Navigate to the Mixed Reality Toolkit > Oculus > Separate Oculus Integration Unity Modules
  2. Let Unity refresh as references in the Microsoft.MixedReality.Toolkit.Providers.Oculus.asmdef and other files are modified in this step
  3. Close Unity
  4. Close Visual Studio, if it's open
  5. Open File Explorer and navigate to the root of the MRTK Unity project
  6. Delete the UnityProjectName/Library directory
  7. Delete the UnityProjectName/Assets/Oculus directory
  8. Delete the UnityProjectName/Assets/Oculus.meta file
  9. Reopen Unity

Oculus Unity

Common errors

Quest not recognized by Unity

Oculus Unity C#

Make sure your Android paths are properly configured. If you continue to encounter problems, follow this guide

Oculus Unity Integration

Edit > Preferences > External Tools > Android





Coments are closed