Oculus Quest Unity



Getting Started

  1. Oculus Quest Unity Mac
  2. Connect Oculus Quest To Unity
  3. Oculus Quest Unity Link
  4. Add Second Camera Oculus Quest Unity
  5. Unity Oculus Quest Development
  6. Oculus Quest Unity Black Screen
  7. Oculus Quest Unity
  1. Go to Unity Download page, click Download Unity Hub, and install it. On the Installs tab, click Add, and select the Unity version from the list. In the Add modules to your install window, select Android Build Support and expand it, select Android SDK & NDK Tools and OpenJDK, and click Done. This is only available for Unity version 2019.x and higher. For Unity 2018.x and prior, go to Install Android Tools.
  2. Get the Right Hardware. Oculus Link is in beta, but you can see the latest hardware requirements on.

With the arrival of the Oculus Quest 2, we know a lot of new people will be inspired to create their very first VR experiences. That is why we have put together this step-by-step guide to getting started, so pull up a chair and get ready to develop for the Quest platform!

The first thing to acknowledge if you are new to XR development is that you need three things to create a VR application:

Oculus Quest Unity
  1. A Game Engine
  2. An SDK (Software Developer Toolkit)
  3. A VR Headset (+ compatible USB cord & the Oculus Smartphone App)

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. How to set up Oculus Quest Link for Unity's play mode. Go in and out of play mode for your VR game without needing to build and deploy to your device!I'm ta. In Today's video I walk you through setting up your Oculus Quest 2 with developer mode which means that we will be able to create a Unity3d project and push.

In this article, the three of these that we will look at are the most popular choices for VR at the current moment:

The Unity Game Engine
The Unity XR Interaction Toolkit
The Oculus Quest or Oculus Quest 2

Not coincidentally, these are the tools we work with most commonly in our 12-Week AR VR Developer Bootcamp. Let’s use them now to get you up and running. For this guide, you will not need to know C# or write any code. Also, we will use the Unity Interface and other GUI software to configure everything for your VR scene.

Additionally, do you want the chance to take care of some of these steps and download a free VR game at the same time? Try this SideQuest tutorial, and then come back to this article when you’re ready to develop your own game.

Step by Step Guide

Step 1. Set up the Right Version of Unity

Unity is constantly updating and improving its software by creating new versions. In order to pick the version we need, you need to follow a few steps:

Whether or not you use the free or paid version, you will need to create a license in order to use Unity. You can either follow the instructions in this video linked here, or follow the directions below.

  1. Click on the gear icon in the top-right-corner next to the profile icon.
  2. Navigate to ‘License Management’, and then click on the blue “Activate New License” button.
  3. From the window that pops-up, select the appropriate license you will be using. (Thankfully, the Unity Personal license is free!)

If you get lost in these written steps, there is always the video instructions.

Once Unity Hub is installed, you can download Unity itself. From installs, Select the right version of Unity:

  • Use the “Installs” Tab in Unity Hub to find and select the version you want to use:
  • Note: To support the XR Interaction Toolkit (i.e., VR functionality) must be versions 2019.4 or later.
  • Ideally, choose a version with Long Term Support (LTS).
Unity oculus quest development

Step 2. Adding Modules

Under the Installs Tab, add these modules to your version of Unity:

  • If this is your first time using Unity, you will want to add “Microsoft Visual Studio 2019”; it’s a very nice Integrated Development Environment (IDE) for coding in C# within Unity (which most Unity devs use).
  • You will need to check the box for “Android Build Support” since the Oculus Quest is technically an Android device (The Quest runs on a customized build of Android 7, and the Quest 2 runs on Android 10.)

Step 3. Add the XR-Related Unity Packages to Your Project

Note: Adding the Unity Packages required for XR will be a process you repeat for every new Oculus Quest project. You will get used to it over time.

Create a new Unity Project from Unity Hub.

  • Make sure to save your project somewhere you can find it later.
  • For “template”, the choice between 3D, 3D with Extras, and the Universal Render Pipeline are a little too detailed to explain in this article. However, we can tell you that while either would work for a starter VR project, the ‘Universal Render Pipeline’ has more optimized graphics (which you will learn to appreciate as you get further into VR development).
  • Choose ‘Universal Render Pipeline’.
  • Once selected, hit the “Create” button.

Now that your project is both created and open, use Unity’s ‘Package Manager’ to import a couple of VR-related packages into your project:

In the drop-down menu, on the top left, find ‘Window > Package Manager’, and open the ‘Package Manager’.

Oculus Quest Unity Mac

Once the Package Manager window shows up, you can either scroll through the list or type in the search-bar to look for packages.

  • From the Package Manager, Click ‘Advanced’> ‘Show Preview Packages’.

Now, Find and Install these three packages with the Install button in the bottom right corner of the window:

  • The ‘XR Interaction Toolkit’ package
  • The ‘XR Plugin Management’ package
  • The ‘Oculus XR Plugin’

Now, with packages installed, you are ready to start changing the ‘build settings’ of your project!

Step 4. Project Build Settings

First, in the dropdown menu at the top left, navigate to ‘File > Build Settings’.

From Build Settings, you will want to switch your platform from PC to Android because, technically, the Oculus Quest is an Android device. (The Quest runs on a customized build of Android 7, and the Quest 2 runs on Android 10.)

  • Do this by selecting ‘Android’ in the list of ‘Platforms’ and clicking on ‘Switch Platform’ in the bottom right of the window
  • (Note: Currently, your project is empty, but in the future, this may take a while depending on how many assets in your project you need to reimport; ideally you would do this step before you’ve added anything into your project.)

Next, in the Build5 setting that will show up, Change the “Texture Compression” dropdown to ‘ASTC’.

Now, in the dropdown menu at the top left of Unity, navigate to ‘Edit > Project Settings’ and, in the window that pops-up, select ‘XR Plugin Management’. Telegram desktop for mac.

Quest

Click on the ‘robot icon’ in the-top-right to bring up plugins for standalone devices, and check the box next to ‘Oculus’. It may take a minute to import. This is normal.

Now, you will need to adjust your ‘player settings’. Navigate back to ‘Edit > Project Settings’, and from the list on the left of the window select ‘Player’.

Name your Company and your Product Name. This will make it easier to find your app once it’s on your Quest device.

Then scroll down and find the “Minimum API Level” and set it to at least level 23 (6.0 marshmallow)

Step 5. Creating a Quick Scene

You need something to load onto your Quest device!

Create a new scene by navigating to ‘File > New Scene’.

With the ‘XR Interaction Toolkit’ installed, you should be able to navigate to ‘GameObject > XR > Device Based > Room-Scale XR Rig. For some, the action based rig may not track controllers first try, but the Device based rig will, and the priority is to make sure building and running onto the headset works.

Add a floor to stand on in your scene by going to ‘GameObject > 3D Object > Plane’.

Chocolate for mac. Save your Scene: ‘File > Save’

Now that is saved, navigate back to ‘File > Build Settings’, and below the box at the top, click ‘Add Open Scenes’, and un-check the starting ‘Sample Scene’.

Step 6. Android Tools and Sideloading Time

Sideloading is a term used in the developer community that means installing an APK file onto an Android device. (APK stands for Android Package File.) Since the Quest devices are built on Android, sideloading means the same thing here.

In short, you will be sideloading an APK file from Unity onto your Quest device.

But, before we can sideload an APK file from Unity to your Oculus Quest, you need to first install some Android Development tools.

6 a. Install Android Developer Tools

  • Download Android Studio. Note: the Mac Download is on a different page)
  • After Installation, when you open Android Studio, find the ‘Configure’ button near the bottom right, click on it and select ‘SDK Manager’

Install any version of the SDK later than 4.4 Kitkat, API Level 23 (Use Level 19 or higher if Level 23 is not available), by checking the box and hitting “Apply” at the bottom right corner of the window.

Check the SDK Tools Tab to make sure you have Android SDK Build-Tools and Android SDK Platform-Tools installed.

6 b. Register with Oculus as a Developer

Connect Oculus Quest To Unity

Now, in order to turn on Developer Mode on your Quest, you will need to register as a developer with Oculus:

Go to the Oculus phone app on your phone (The one you used originally to set up your Quest.)

  • Make sure your headset is turned-on and nearby so that your phone can connect to it.
  • Once you see that your Oculus device is connected to your phone, follow these directions to enable developer mode
  • Video Directions: https://youtu.be/CQ6TcLwSGag?t=260

Log in to your Oculus account.

  • Go to: https://dashboard.oculus.com/organizations/create/
  • Create an Organization name: This can be anything you want.
  • Accept all agreements after reading.
  • Now your organization will appear on the left side (CaseyXR in this example)

6 c. Windows Users only: Download ADB Drivers (This step not required for Macs)

If you are on a PC, download these drivers (Mac owners do not need to follow this step):

Extract the files

  • Navigate to the ‘androidwinusb.inf’ file> right click>install. Then, click ‘open’. Allow any messages

Step 7. Getting your phone and Quest ready

Now that you have followed the directions for enabling developer mode on your Quest, go get your smartphone and the USB cord you plan on using to connect your Quest to your computer…

Start with your smartphone

Quest

Find your headset in the Oculus phone app, and click on it to make sure it is enabled

Select ‘More Settings’, click on ‘Developer Mode’, and enable it.

  • You may be asked to create a Developer certificate. Accept.

Now the developer mode is enabled for the Quest through your phone, reboot your Oculus Quest by turning it off and on.

After it has rebooted, Connect your Quest device to your computer using a USB cord. (The charging cord that came with your quest will work as long as your computer has a USB C port.)

  • If you don’t have that kind of cord, you can shop for a compatible cord or adapter (USB C to USB or Get an Adapter).
  • If your computer does not have a USB C port, check to see if your Android smartphone charging cable will work.

Now that your Quest is plugged into your computer, look inside your VR headset.

Oculus

There might (or might not) be a pop-up that asks you to “allow USB Debugging”. If so, click ok (using the Oculus Quests’ controllers.)

  • If you get an “Oculus Link” pop up. Click “Not Now.”
  • If it asks you to set up a guardian, go ahead and do so.
  • Then, take off your headset.

Go back to Unity and check to make sure your headset is recognized when it is plugged in.

  • Navigate back to ‘File > Build Settings’, and see if your device is recognized under ‘Run Device.
  • (Note: You may need to hit the refresh button, seen below, after plugging in your headset.)

Now click ‘Build and Run’ at the bottom right of the ‘Build Settings’.

Name your build (and ideally save it in its own Builds folder.)

Be sure to wait for the build to complete before putting on your headset!

Behold, you have created a VR world with Unity! No longer are you confined to the limits of this reality.

If the app doesn’t start automatically when you put on the Quest, go to your ‘apps tab’ in your Quest device and find the section called “Unknown Sources”, where you can find the app by the name you gave it (e.g., MyFirstVRApp”).

If everything worked, you should be able to see your floor and a couple of red lines coming from your Controllers!

Add Second Camera Oculus Quest Unity

Congratulations

You have now, hopefully, built your first application for the Oculus Quest or Quest 2! Now, it is up to you to add items to your scene in VR.

We would love to show you how to do this at one of our upcoming events and webinars. Or, even better, we’d love to talk with you about joining one of our live 12-week-long bootcamps taught by experts in AR x VR Development and AR x VR Visual Design.

Got stuck or have questions?

-->

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.

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

  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

Unity Oculus Quest Development

  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

Using the Oculus XR SDK Data Provider

  1. Configure your profile to use the Oculus XR SDK Data Provider Chrome canary for mac.

    • 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

Common errors

Oculus Quest Unity Black Screen

Quest not recognized by Unity

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

Oculus Quest Unity

Edit > Preferences > External Tools > Android