Occulus Go Devlopment Pipeline
In this post I’ll walk through the development pipeline we (Biweekly Entertainment) have been using in order to deploy to the Occulus Go. The Go is a self-contained VR device so it does not utilize any extra-unit computational power. As such the usual pipeline of deploying directly from the Unity Editor as you would with the Rift or the Vive is insufficient. We need to interface with android software to create a .apk to run from the go itself.
Set-Up:
The set-up process is a bit arduous, but once everything is correctly in place it’s easy to quickly test and iterate on the go itself.
Step 1: Install and set-up Android Studio:
The first step is to download Android Studio if you don’t already have it. You can find a download link here: https://developer.android.com/studio/
Once it’s downloaded, open it up and you’ll be greeted with this window. Navigate to the configure drop-down on the bottom-right of the window.
- On the SDK platforms tab, make sure that API levels 21 through 28 are checked.
- On the SDK Tools tab, check the box next to Show Package Details in the lower right corner of the window
- Under Android SDK Build-Tools 28-rc2, make sure the highest numbered item is check that does not end with “-rc1” or “-rc2”. As of this writing, that is 28.0.2.
- Also make sure LLDB, Android SDK Platform-Tools, Android SDK Tools 25.2.5, and NDK are all checked.
- Click Apply
Next we need to configure our PATH environment variable so your machine knows where the various packages are locates.
- Return to the homepage of Android Studio and once again go to Configure, this time selecting Project Defaults > Project Structure
- You’ll see a window that looks like this. Copy the locations of the Android SDK, JDK, and NDK into a text editor, we’ll need these in a second.
- Now, navigate to your environment variables. On a Windows machine you should be able to search “enviornment variables” and Cortana will pull up the correct window. (On Mac you can set your enviornment variables through the terminal. Here’s a guide: https://medium.com/@himanshuagarwal1395/setting-up-environment-variables-in-macos-sierra-f5978369b255)
- Set JAVA_HOME, ANDROID_HOME, ANDROID_NDK_HOME to what we just copied.
- Add JDK TOOLS to your PATH ie C:\Program Files\Android Studio\jre\bin
Step 2: Set-Up Unity to build to Android VR
Now we need to set up Unity to know how to build to the Go.
- Ensure that Android Build Support is installed with your version of Unity. If it isn’t you can redownload the Unity installer, run it, and make sure it installs the Android Build Support.
- In Unity, navigate to File > Build Settings. On the list on the left select Andoid then select Switch Platform. This part may take a little while for it to switch over.
- Go to Edit > Preferences and go to the External Tools tab and scroll down to the Android section. There set the Android SDK, JDK, and NDK to what you set them to in Step 1 (Unity comes with a built-in JDK so you can use that if you wish)
- Go to Edit > Project Settings > Player. In VR Settings, check the box next to Virtual Reality Supported.
- Make sure Occulus is on the SDK list. If it’s not, click the ‘+’ and add it.
- Head back to the top of this window and set Company Name and Product Name (in our case BiweeklyEntertainment and OldMenWithKites)
- Scroll down to Other and set Package Name to CompanyName.Product Name (so for us BiweeklyEntertainment.OldMenWithKites)
- Set Minimum API level to 21
- Last, you will need to get the Occulus Core Utilities for Unity. You can find these here: https://developer.oculus.com/downloads/unity/
Step 3: Set-Up the Go
We’re now mostly set up on your PC, we now just need to ensure the Go is set up properly by enabling developer mode.
To begin development locally for Oculus Go, you must enable Developer Mode in the companion app. Before you can put your device in Developer Mode, you need to have created (or belong to) a developer organization on the Oculus Dashboard.
To join an existing organization:
- You’ll need to request access to the existing Organization from the admin.
- You’ll receive an email invite. Once accepted, you’ll be a member of the Organization.
To create a new organization:
- Go to: https://dashboard.oculus.com/organization/create
- Fill in the appropriate information.
- Enable Developer Mode
To put your Oculus Go in developer mode:
- Open the Oculus app on your mobile device.
- In the Settings menu, select your Oculus Go headset that you’re using for development.
- Select More Settings.
- Toggle Developer Mode on.
Finally it’s worth noting that when you connect the Go to your PC via the USB cable that comes with the Go you will need to make sure the Go trusts your device. Connect the two then don the headset and acknowledge that you always trust your computer.
Step 4: Set-Up the Android Debug Bridge
The final step of the setup is to build the bridge that allows you to transfer APKS built on your PC to the Go for play.
- Head to this link https://forum.xda-developers.com/showthread.php?t=2588979 to download and install the ADB. Make sure you Run the Installer As Administrator!
- During installation say yes to each of the requested features by typing ‘y’
- You’ll need to add ADB to your PATH as we did before, finding the install directory and adding this to your PATH environment variable.
- Once all this is set up you should be able to run your command prompt (or terminal) and type ‘adb devices’ and your Go should come up if its connected!
- NB: your Go must be powered on on your computer will be unable to detect it! (Sounds obvious but its easy to forget this!)
Building:
Once all of the above set up is completed it’s possible to actually build to the Go by following these steps:
- Ensure the Go is powered on and connected to your computer via the USB cable.
- Head to Edit > Build Settings in Unity, and select Build
- Make sure in this window the Run Device is set to your Go! If your device does not appear try hitting refresh.
- Run your command prompt (or Terminal) in the same folder as the generated .apk file
- Now, to push your build to the go simply type adb install ___.apk
- Your command terminal should look like this if the install was successful.
- Put on the headset and navigate to the menu.
- Select Library
- Select Unknown Sources on the left
- Select your build from the list
- Test your game!
Note that these steps get slightly more complicated on repeat application because you need to first uninstall the package before you can reinstall.
- Type adb shell pm list packages into your command prompt (or Terminal)
- Find the name of your package (this is the same as the name you set in Unity so you can also get the name of the package from there)
- Type adb uninstall package name (in this case com.BiweeklyEntertainment.OldMenWithKites)
- Now you can install new apk builds as normal
There you have it! That’s the process for getting a build up and working on the Go. Hopefully this post can be of help to prospective future Go Developers.
In other news, Biweekly Entertainment and its project are going well and we’re excited to show off what we’ve got for tomorrow’s presentation!