Build a VR game with VRTK for the Oculus Quest. Part 1.

Victor Buldakov
5 min readSep 27, 2019

In this tutorial I’ll help you create your first game for Oculus Quest from scratch. Let’s get started!

Introduction

After going through this tutorial you will be able to create a simple VR game for Oculus Quest in Unity using Oculus SDK and VRTK. VRTK is the toolkit for quick creation of VR experiences, it provides a lot of features and helps easily ramp-up in VR development by using lots of VR primitives and patterns already implemented for you.

In the article series I will demonstrate how to configure frameworks to create a simple project using VRTK and Oculus integration in Unity, address common problems and implement a simple game based on interactions with objects.

Project

Virtual Skeeball

I hope that most of you watched a popular animated sci-fi sitcom “Futurama” where there was a game called Virtual Virtual Skeeball (season 1, ep.2). In this article series we will implement only a Virtual Skeeball, and you can work on Virtual Virtual Skeeball as a follow up :)

Final Result

The result is going to look like this :)

Unity VR configuration

So let’s start by creating an empty Unity project from the 3D project template.

We need to configure the created project to run on Oculus Quest.

Oculus Quest is running Android, so first of all you should go to File -> Build Settings and select Android from the list. If you don’t have an Android Integration installed, Unity will suggest you to go to the download page. You can read how to set up the Android environment here https://docs.unity3d.com/Manual/android-sdksetup.html.

I have already installed Android SDK so to proceed with configuration I will change platform to Android by pressing the Switch Platform button.

Switch platform to Android in the build settings.

After that we have to make sure that Virtual Reality support option is enabled. For that press on the Player Settings button in Build Settings window in Android tab, then scroll down to the XR Settings group in the open window.

Here we have to make sure that the Virtual Reality Supported option is selected. Also, you have to add Oculus as one of the Virtual Reality SDKs.

XR Settings

Then navigate to the Other Settings tab in the same window (Player Settings).

We have to change here:

  • Scripting Runtime to .NET 4.x Equivalent
  • Colour space property to Linear.
  • Minimum version of the Android SDK for Oculus Quest is 4.3

Oculus Support Configuration

Now let’s configure Unity to work properly with Oculus devices.

First navigate to Window → Package Manager

We should find and install an Oculus Android package, this package is required if you would like to deploy and run you game on the Oculus Quest device.

Oculus Android package

Then let’s go to the Asset Store

We need to find Oculus Integration and import it to your project.

Oculus Integration page in the Unity Asset Store

While Oculus Integration is being imported to the Unity, we can go to the Oculus Dashboard dashboard.oculus.com and create a new App, you can name it whatever you want, for example, I named it SkeeballVR:

Oculus Dashboard creation form

Copy the App Id and get back to Unity.

App ID which we should use in the Unity

Open Oculus ➝ Platform ➝ Edit Settings and insert a copied id to the Oculus Go/Quest or Gear VR field.

Enter the copied id to Unity

Also, to make sure that Oculus Integration is working correctly with Oculus Quest, we should go to the Oculus ➝ Tools menu and generate a store compatible AndroidManifest.xml

Create an Oculus Store compatible manifest

VRTK configuration

If you use Unity 2019.1 and higher, you should also add a special package for VRTK compatibility.

Go to Window → Package Manager

Here we should find XR Legacy Input Helpers and install this package.

The last set up step is to download the VRTK library.

  • Go to the Assets folder in the project folder and clone VRTK github repo there:

git clone — recurse-submodules https://github.com/ExtendRealityLtd/VRTK.git

  • then go to the VRTK folder and update git submodules:

git submodule init && git submodule update

So here we are, we have a set up project which can be run on Oculus Quest. If you would like to test that everything is working fine, open VRTK/Samples/Farm/Scenes/ExampleScene and press play, it would run a VRTK demo scene in the Unity Player.

Deploy and run on Oculus Quest

At the beginning we need to configure an Oculus Quest to run in the development mode.

In the Oculus mobile app go to the headset settings and select More Settings ➝ Developer mode and enable Developer mode.

Connect Oculus to the computer. Oculus Quest headset will request to trust the device so you’ll have to put the helmet on and select to trust this device.

In Unity go to the build settings and add your scene to the list of scenes. Make sure that your scene is the first one.

Press build and run.

And that’s it! Now you have a running empty scene on an Oculus Quest.

An empty scene running on a Oculus Quest

Next

In the next chapter we will handle events from the controllers to make objects follow controllers’ position and allow interactors to interact with objects in the scene.

Code

The code for the whole series could be found here:

https://github.com/v1ctor/SkeeballVR

--

--