Zephyrnet Logo

How to set up Unity for Oculus Quest Development (With an example of a sample application)

Date:

This is a brief article on how to set up Unity for VR development, specifically for Oculus Quest. This will be helpful for you to get started with Oculus Quest development and to read and follow my future articles related to Oculus Quest development. With the latest Unity release (2019.3.X onwards), you can use ‘XR Plugin Management’ to easily set up the Unity development environment to build and deploy VR applications. You no longer have to go to the ‘Player’ → ‘XR settings’ configurations (Well if you do not know what that means, don’t worry this is going to be depreciated in the upcoming Unity versions).

All right let’s get started.

First things first. Prerequisites for this set up are Unity Version 2019.3.X (I will be using Unity version 2019.3.15f1) and working internet connection. Optionally, to test this setup I will guide you through building a quick sample application. In order to try that, you should have Oculus Quest and a Link Cable. However, the main purpose of this article is to help you with setting up Unity for Oculus Quest Development.

First, open Unity Hub and create a new Universal Render Pipeline Project. Refer to Figure 1 below.

Figure 1

Your Unity window will initially look like in Figure 2 below.

Figure 2

If you want to change this layout (That is the placement of different panels), you can go to the Layout button on the top right corner (See Figure 3 below) and click on a different option and select what you prefer the most.

1. Designing for a modern 3D world: A UX design guide for VR

2. Scripting Javascript Promise In Spark AR For Beginners

3. Build your first HoloLens 2 Application with Unity and MRTK 2.3.0

4. Virtual Reality: Do We Live In Our Brain’s Simulation Of The World?

Figure 3

Once you are done with that, you have to install the Oculus Integration package from the Asset store. It is free. To do that, go to WindowAsset Store or Press Ctrl + 9 if you are on a Windows PC. After that search for Oculus Integration and click on Download and then Import. Refer to Figures 4, 5, and 6 below.

Figure 4

Click on Download…

Figure 5

..then import.

Figure 6

Make sure that you click All and Import, again on the Import Unity Package window that pops up. See Figure 7 below.

Figure 7

You might get following prompts asking to enable newer OVRPlugin’’, click Yes.

Figure 8

In addition, if you get the following prompt, click on Upgrade.

Figure 9

Alright, we are getting there. Next, you have to add some more packages.

Go to WindowPackage Manager. This will open the Package Manager Window and make sure to tick on Show Preview Packages under Advance option.

Figure 10

Then search for XR Integration Toolkit and click install. See Figure 11 below.

Figure 11

Once the installation is completed, go to EditProject Settings and you will see the new XR plugin Management. See Figure 12.

Figure 12

Click on Install XR Plugin Management. Again once the installation finished, click on Oculus under Plug-in providers. Do this for both standalone and Android development. Refer to Figures 13 and 14.

Figure 13 Figure 14

When finished close the Project Settings window and go to FileBuild Settings and then select Android and click Switch Platform. Refer to Figure 15 below. This might take a little while if you are doing this for the first time.

Figure 15

Once finished, you are all set to start building your Oculus Quest VR application.

Let’s build a VR cube demo with the above setup

I thought of adding a quick demonstration to help you to get started with your application development. This is an optional section in this Article. For simplicity, let’s create a VR cube and see whether we can up and run it on the Oculus Quest.

First, go to the Project panel and select the Scenes folder and double click to open it. Right-click and go to CreateScene and give it a name that you like. I will name it as TestQuestVR. Then double click on the scene to open it. See Figure 16 below.

Figure 16

Next, I will delete the Main Camera. See Figure 17.

Figure 17

After that go to the Project panel and search for OVRCameraRig and then click and drag it to the Hierarchy panel.

Figure 18

Make sure that its position is set to X:0, Y:0, and Z:0. Also, set the Tracking Origin Type in the inspector panel to Floor level. It will adjust the camera view to the user height. Refer to Figure 19.

Figure 19

Next right-click on the hierarchy panel and create a new 3D object — Cube.

Figure 20

And set it’s a position to X:0, Y:0, and Z:2.496 (Well, feel free to adjust this), and size to X:0.2, Y:02 and Y:0.2 (Again feel free to adjust this if you want).

Figure 21

I like the color Red, so I will quickly create a red material and apply it to the Cube. To do that, go to the Project panel and click on the Material folder and create new material as shown in Figure 22 below. After that click and drag it to the cube game object in the Scene window (alternatively you can drag and drop it to the Cube game object in the hierarchy panel as well).

Figure 22

You are all set to experience our first VR application. Before deploying this to the Oculus Quest you have enabled developer mode on your Oculus. If you don’t know what that means and how to do that, read my very brief article on “How to enable Developer Mode on Oculus Quest”.

Alright, there are two ways to test this application. If you have an Oculus Link cable (which I recommend if you are planning to do Oculus Quest development) then plug the Quest to your PC using Oculus Link cable and you hit the play button on the Unity and that’s it. Otherwise, you have to build the ‘apk’ and upload it to the Oculus Quest with a default cable that comes with the Oculus Quest (Oculus recently enabled link support to the default cable and you need to enable ‘Public Test Channel’ in Oculus app to get a Beta release to try this. However, they still recommend Oculus Link cable and I still couldn’t test it with Unity so I cannot recommend it to you).

Anyway, to make it quick I am going to use Link Cable, but let me know in the comments section if you face any issues with building and deploying this.

Figure 23

Well, that’s it. Congratulations! This is your first VR application.

If you want to thank me or if you like the content that I create;

Cheers!

Source: https://arvrjourney.com/how-to-set-up-unity-for-oculus-quest-development-with-an-example-of-a-sample-application-c8b58e25ad4b?source=rss—-d01820283d6d—4

spot_img

Latest Intelligence

spot_img

Chat with us

Hi there! How can I help you?