Notifications
Article
Deploy your first Oculus Go App
Updated 6 days ago
558
5
You have an Oculus Go and would like to use Unity to deploy your app to it ...
I have been developing on Unity for a number of years but had yet to deploy an application on an Android device. When the Oculus Go was released, I wanted to experience mobile VR, so I picked one up to add to my Vive, Rift and HP MR Headsets.
Unity VR developers love Oculus Go
To keep things simple, we are just going to walk you through deploying a sample scene called cubes.unity that ships with the Oculus Utilities for Unity.
This tutorial assumes Unity 2018.2.17f1 is installed (I highly recommend using the Unity Hub if you are not already doing so) along with the Android support package via the Unity installer. It may work on older versions of Unity but this is untested by me.
Note: Commands to be entered are bold and italicized

Install tool-kits

First we should install the required toolkits
Start with this page https://docs.unity3d.com/Manual/android-sdksetup.html
These are notes about that document
Step 1) Recommend you install Java SDK 1.8 as noted on this page
I uninstalled Java 1.9 which was on my machine as I could not get the sdkmamanager to work with it installed.
Step 2a) Download AndroidSDK and use sdkmanager to install these packages
Example for windows - Windows sdk-tools-windows-4333796.zip 149 MB
2a.6) sdkmanager "platform-tools" "platforms;android-27" "build-tools;27.0.3" (note this can take a while and it should prompt you to accept a license agreement, be patient after you accept as there is no feedback during the install. it may take 5 minutes or longer.)
2a.7) sdkmanager "extras;google;usb_driver" (optional? I installed anyway but might not be needed due to Oculus ADB Go 2.o download in later step)
Step 3) Skip (we do this differently on the Go in the next section)
Step 4) In your Unity Editor preferences add the path to the Android SDK you downloaded
Ignore the suggestion to put the full path in their example "c:\<android tools install location>\platforms\android–27"
To change the location of the Android SDK, open a new or existing project and in the menu bar go to Unity > Preferences > External Tools.
And just enter your actual path to the root folder c:\<android tools install location
in my case that was C:\Users\Glenn\Downloads\Android
While you are here make sure the JDK path is updated to reflect where you installed the Java JDK to in step 1
Step 5) I skipped this as I have not tried compiling for IL2CPP. If you do do please pass the info so I may update this doc.

Device Setup

Next setup your Oculus Go device following these steps
  • https://developer.oculus.com/documentation/mobilesdk/latest/concepts/mobile-device-setup-go/
Note: The first time you try to setup Developer mode and you interact with your Go you need to put the headset on and accept the debugging connection.
  • Download and install the Oculus Go ADB driver if you are on windows.
  • While you are on Oculus's download page, download and save the Oculus Utilities for Unity
https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/ (This is currently version 1.28.0)
  • It is not clear to me if you need this next step to get a simple sample app up and running. I include it as I did follow it as a matter of trying to get things to work. I believe eventually you will need this so better to get it and include it in your project after you create it.
https://dashboard.oculus.com/tools/osig-generator/

Project Setup

Now on to the good stuff
  • Create a new project in Unity 2018.x.x using the standard 3D template
  • Import the Oculus Utilities for Unity unitypackage you downloaded- you may be prompted to accept a newer version. I recommend you do so. The version I installed was 1.28. Unity editor restart may be required.
  • Open up the cubes sample application - Oculus->VR-Scenes->Cubes.unity
  • Open File Build Settings
  • Switch the platform to Android (this may take some time a scripts are recompiled)
  • Click on Add Open Scenes
  • Delete Scenes/SampleScene from the list
  • Click on Player Settings
  • Click on XRSettings
  • Make sure VirtualReality Supported is checked
  • Click on + Virtual Reality SDK's and add Oculus
  • Click on Other setting tab and select Minimum API level Android 4.4 KitKat
  • Save Scene and Save Project
  • Do a test build make sure it is clean - no errors (Subsequent build should be quicker)
  • Connect your Go headset to your PC USB port
  • Select run device from Build settings page
  • Do a build and run (overwrite your previous build)
  • Look into your headset - you should see an array of cubes now

Bonus Section - Wifi Deployment/Debugging (Windows)

By installing the adb package you can support wireless debugging that free's you from being tethered to your development PC.
adb.exe is located under the root android tools folder c:\<android tools install location (in my case that was C:\Users\Glenn\Downloads\Android\platform-tools. Initially run it with your device connected via USB.
Running adb will give a long list of supported commands. See https://developer.android.com/studio/command-line/adb
So lets start with:
  • adb devices (you should see your connected device)
  • adb tcpip <port> (I used port 6502)
  • run adb shell ip route to see your ip address (my output was - 192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.125)
  • adb connect 192.168.1.125:6502 (if you get a successful connection then you can unplug from usb)
  • In the build settings you will need to re-select your device but you will see the option to connect to device name (ip address:port)
  • Do a build and run (still choose your output location), sit back with your headset on and wait for your app to start.
  • Alternatively we can install it with the command adb install <apk-path>
  • in my case that would be
  • adb install -r G:\src\Unity\2018.2\builds\Settings\Cubes.apk
  • When you are finished your debugging session you may issue a
  • adb disconnect

Next Steps

For this last part you will need to install one of the Unity 2018.3 releases (This is where the Unity Hub comes in handy and don't forget to add android build support). I have tested this with 2018.3.0f1, your mileage on previous beta or future release versions may vary.
  • Grab a copy of this sample VR app from Unity - https://github.com/Unity-Technologies/onslaught (A cross-platform VR sample game with no third-party packages.)
  • Open build settings
  • Switch to Android Platform
  • Choose run device
  • Verify player settings
  • Under XRSettings - Add Oculus and remove Daydream
  • Set Minimum API level Android 4.4 KitKat
  • Save project
  • Build (The first build is lengthy due to shader compiles)
  • If you get prompted "Android SDK is outdated" you can try use Highest installed - you may need to choose Update Android SDK
  • Build and run - sit back and enjoy the "Onslaught"
Please leave a comment if you find any issues with these instructions.
If you found this article useful at all please click on the like button.
About this Contributor: Glenn has been working with Unity since 2009. He has developed several 2D and 3D applications. These days Glenn spends most of his time focused on VR and AR applications. Glenn achieved Unity Developer certification in April 2017 (201704UCD1941). Glenn also recently achieved Unity Verified Expert Status.
Glenn Jones
XR Developer (Unity Certified) - Programmer
5
Comments
WeAR_Studio
8 months ago
CEO
We also tried to portate the project from HTC Vive to Oculus, it took us some time compressing the textures, but we did))
1
WeAR_Studio
8 months ago
CEO
Thanks! We had some troubles at first, but then it was better. We also tried to
1
BC
Brij Charan
9 months ago
hi @Glenn Jones My bad, I missed your original note about that. However, I had it happen two more times on the same environment and headset. It seems like the headset sometimes 'forgets' the accepted connection?
It hasn't happened again, so hopefully that's the end of it.
0
Glenn Jones
9 months ago
XR Developer (Unity Certified)
Hi Brij, Is that something different then when I indicated that "Note: The first time you try to setup Developer mode and you interact with your Go you need to put the headset on and accept the debugging connection."? I originally wrote these instructions right when the Oculus Go first came out and sometimes you only have to do these steps once so I might have missed something when I re-validated the steps. Thanks for your feedback.
0
BC
Brij Charan
9 months ago
If you are using the headset for the first time, unity won't see it until you actually authorize the computer to use the headset. You have to do this by plugging in the headset to the computer via usb, then put on the headset and authorize its fingerprint.
0