How to get started with Oculus Go on Unity

The Oculus Go has just been released by Oculus and a lot of developers have started receiving it and are experimenting with it. I’m among them: today I’ve made my first builds and so I want to guide you through the first very basic steps in building an app for Oculus Go on Unity, to spare you some little headaches. This guide will be very very basic and will just introduce you to the initialization of the development environment and in doing the first build. Take my hand and follow me.

Let’s start. You have your shiny new gray Oculus Go on your desk and you want to start developing for it using Unity Engine. That’s great. First of all, we have to enable developer mode on the Go.

How to enable developer mode on Oculus Go

As with all Android devices, you have to enable developer mode to be able to push apps on the Oculus Go. I spent 10 minutes navigating in all menu items inside the Oculus Go, without finding the Developer Mode option. And the reason is: there is no way to enable it inside the headset.

The right place is the companion app, as it is explained in this guide by Oculus. The steps are the following:

  1. Open the Oculus companion app on your phone;
  2. Select the Settings tab;
  3. Connect the app to your headset via Bluetooth. Now you should see just below your name, a menu item with the name of your Go, together with its battery level;
  4. Tap on the name of your Oculus Go, it should open a drop-down list with some settings: Wi-Fi, Controller, etc…
  5. Select Other settings;

    First tap on the Oculus Go name, then select Other Settings in the drop-down menu (sorry for the Italian language of my Phone!)

  6. In the screen that will pop up, select Developer mode;
  7. Enable developer mode.

Notice that to be eligible for developer mode, you have to:

  • Have an Oculus developer account;
  • Have at least an associated organization. If you don’t have an organization, just create a fake one in your developer dashboard.

Now your headset is unlocked for development, cool!

Set up the development environment

Now you have to set-up your Unity development environment.

First of all, you have to install the Android SDK and Android SDK Tools. I won’t go too much into details about that here, because it would require a separate guide only for that. Usually, this means installing Android Studio and then using its IDE to install the required Android SDK (by selecting Tools->Android -> SDK Manager inside Android Studio). At the current time of writing, Go runs Android 7.1 (SDK 25) so be sure to install that SDK version. Install also the various SDK Tools and Platform Tools. After that, put the directory <Android_sdk_install_dir>\platform-tools inside the PATH environment variable. If you want some help for all this process, have a read to this tutorial.

Let’s see if things are working correctly: connect your Go to your PC via USB. Put the Go on your head and look inside it: accept whatever pop-up you will see there asking for an authorization.

Now remove the headset and see if things are working: open a command-line window (Win+R and then run “cmd”) and type “adb devices”.

At this point:

  • If things are working well, you should see the ID of your device and the caption “device”;

    If you see something like this, then you can drink some champagne

  • If things are not working well, you may see no output or the ID of your device with the caption “unauthorized”. Or the PC may even not recognize the command “adb”. Troubleshooting:
    • Check to have installed Android SDK and have put the directory of the SDK platform tools inside the PATH environment variable;
    • Install Oculus ADB drivers. Things are working fine for me even without them, but Oculus suggests to install them;
    • Check if the cable is connected correctly;
    • Check if you have granted all authorizations inside pop-ups that appeared on the device;
    • Disconnect and re-connect the USB cable and accept all the authorizations inside the headset again. You have to see at one point a dialog asking you to authorize a device with a certain fingerprint to do USB debugging. When you accept this dialog, make sure to select to always accept that computer and you are ok forever. If you don’t see this dialog, you will always see your device as unauthorized.

Now you have just to install Unity (Oculus recommends version 2017.4.1): you can access the various Unity versions from here. When installing Unity, at a certain point the program will ask you what features to install: make sure to install the Android platform support.

The last thing you have to download is the Oculus Utilities for Unity: you can find it inside Oculus downloads, exactly here. Save the Unity package somewhere in the disk.

Ok, we’re ready to develop now!

Oculus osig file?

If you’re already a Gear VR developer, you may remember that to push your app on the Gear VR you needed an annoying thing called Oculus Osig file, that you had to insert inside your Unity solution. With Oculus Go, this is no more needed (YEEEEEEEESSSS!), so you don’t have to worry about this.

Your first Oculus build

Ok, now we’ll make the first build on the Oculus Go.

Open Unity and create a new 3D project, giving it whatever name you do want. Select Assets -> Import Package -> Custom Package… and open the Oculus Utilities file that you saved some instants ago. Import everything and let Unity do its stuff.

Go in the Project window of Unity (the one that seems a file manager) and select the directory Assets\Oculus\VR\Scenes. Double click on the Cubes file to open the standard scene full of cubes. This is the sample scene that we’ll build in this tutorial.

Now go to File -> Build Settings. Select:

  • Add Open Scenes, to add the current scene to the build;
  • Select Android platform. Then click on Switch Platform to let Unity switch to Android mode;
  • Build System – Internal, because I had problems using Gradle.
These are the settings that you must have to build correctly the scene

After that, select “Player Settings…” and look at the tab that opens on the right part of the screen. There, you should:

  • Change company name and product name to whatever you want;
  • Other Settings -> Package Name: set a package name as you prefer;
  • Minimum API Level: whatever value >=19 is ok. If you don’t have the SDK that you selected, Unity may ask you to install it;
  • XR Settings (SUPER IMPORTANT):
    • check “Virtual Reality Supported”
    • Add “Oculus” to the Virtual Reality SDKs list, using the little “+” button below it.

      If you don’t apply these settings, when you launch your app, your eyes will cross

Ok, we’re almost done… return to the Build Settings window. Click on Build And Run. Select where Unity has to save the generated APK… and then let the magic happen! Unity will make some work and then will launch the app directly on the Go! Wear your device and enjoy your cubes…

Wow, you’ve built your first sample app… now you’re ready to develop your own Go games. I’ve just made a porting of our Hit Motion full body game that uses ImmotionRoom system… who has said that Go is for seated experiences? 😉

Happy coding! (And please subscribe to my newsletter to sustain my efforts in writing cool VR articles! 😉 )

UPDATE: On Twitter, P. Patterson Nowist kindly suggested some settings to improve the resulting application:

  • Enable “Single Pass Rendering” (Player Settings -> XR Settings -> Stereo Rendering Mode -> Single Pass) to improve performances;
  • Enable Anti-aliasing in the Quality settings (Edit -> Project Settings -> Quality -> select Medium profile -> Antialising -> 2x) to make things appear better.

 

Skarredghost: AR/VR developer, startupper, zombie killer. Sometimes I pretend I can blog, but actually I've no idea what I'm doing. I tried to change the world with my startup Immotionar, offering super-awesome full body virtual reality, but now the dream is over. But I'm not giving up: I've started an AR/VR agency called New Technology Walkers with which help you in realizing your XR dreams with our consultancies (Contact us if you need a project done!)
Related Post
Disqus Comments Loading...