Made With Unity | Unity VR Part 1: Setting Up Oculus Quest And OpenXR

Small series of articles / tutorials in getting to know VR on Unity and using the Oculus Quest headset.

Developer Mode ON

Download the Oculus app to your specific device

Oculus App on Play Store
Oculus App on the App Store

Once you link your Facebook account and have follow the instruction to pair your Oculus Quest with your device, on the app go to Devices ->Headset Setting->Developer Mode turned Developer Mode ON.

If it is the first time turned on Developer Mode you will be prompt to create a organization with your Oculus Developer Account, follow the instruction, go back to the app and turned ON Developer Mode.

Setting Up Oculus Link

Oculus Link is a special feature of the Quest and Quest 2 VR headsets that turn them into PC VR headsets, you can play any PC VR games that work with the Oculus Rift. When using Unity you will need to turn on Oculus Link to prototype Unity project and see the output on the Editor.

Download the Oculus Developer Hub and the Oculus Client program

Oculus Developer Hub: https://developer.oculus.com/

Oculus Client: https://store.facebook.com/quest/setup/?utm_source=https%253A%252F%252Fwww.google.com%252F&utm_medium=organicsearch

Install both program on your computer and follow the instruction to link your Quest device on both Oculus Developer Hub and the Oculus Client.

NOTE: There is no need to have the Oculus Developer Hub installed on your system, you only need to have the Oculus Client. But there are some cool feature you can only get if you have the ODH installed.

Setting Up Unity

Create a new Unity project with the version being 2021 LTS using the 3D UPR Core template.

Using the Package Manager ->Unity Registry we need to download 3 important requirement to develop on VR: OpenXR, XR Plugin Management and XR Interaction Toolkit

OpenXR Plugin

When installing OpenXR Plugin you will be prompt to enable the New Input System for now say No.

XR Plugin Management

When checking for the XR Plugin Management upgraded if is necessary and say Yes when prompt.

XR Interaction Toolkit

In Unity 2021 LTS the XR Interaction Toolkit will not appear on the Package Manager, you will need to find it on + ->Add package by name-> type com.unity.xr.interaction.toolkit and press Add, press I Made a Backup, Go Ahead!

Having the XR Interaction Toolkit downloaded import both the Starter Assets and the XR Device Simulator on the Samples section.

Now go to Edit -> Project Settings ->Player on the other settings in the Active Input Handling select Both

This will allows us to have both the Current Old Input System and the New Input System Package running on Unity.

Creating The XR Player

XR Settings

Create two empty GameObject named one of them as [ — XR MANAGER — ] and the other one XR Input Action Manager. On the XR Input Action Manager add the script component Input Action Manager and add on the Action Assets the XRI Default Input Actions

Inside the XR Interaction Toolkit folder, located inside the Samples folder, select each XR Preset, 5 in total, and on the Inspector select Add to with there corresponding preset name.

On the Project Setting windows go to Preset Manager and on the ActionBaseController write Right and Left according to the image below.

Still on the Project Settings windows got to XR Plug-in Management, select OpenXR in the Plug-in Providers and enable Initialize XR on Startup on both the PC Computer icon and on the Android icon.

Small Environment Creation

Add a Cube on the Scene and rename it Floor with the following Transform Values

Create a Material and called it floor_mat and added to the Floor GameObject

Right click on the Hierarchy and add a XR->XR Origin (Action-based). On the XR Origin GameObject on the Tracking Origin Mode select Device and on the Camera Y Offset field put your height in meters (I’m 5.4 feet height in meters is 1.64592)

With your Oculus headset connected to the PC, turned on Oculus Link, you can do from the inside of your headset or use the Oculus Developer Hub to turned it ON, you can also turned OFF the Proximity Sensor so if you take off the headset it won’t interrupt the output on Unity.

You know Oculus Link is enable when your inside a white room environment

Press Play.

Up next will be to play around with the interactable feature.

🎮UNITY VR PART 2: INTERACTORS🎮

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store