The main reason I purchased the Gear VR was to develop games for it using Unity. Let me say this right away: getting set up for the Gear VR is not as straightforward as with Oculus Rift. However, with this Quick Start Guide, you will learn how to set up all the software you will need to start using your own Unity app with the Gear VR.
The following steps are applicable to Windows and Mac, with only slight differences in directories. If you’re familiar with Android development with Unity, you can skip to step 8.
- Step 1: You’ll need to install the Android SDK and the latest Java Development Kit for your respective platform.
- Step 2: Install both and open up Android Studio.
- Step 3: Click on Configure > Project Defaults > Project Structure
- Step 4: Here, you’ll find the locations for both the Android SDK and the JDK. Copy these; you’ll need them for Unity.
Note that you may need to display hidden folders in Windows if you’re having issues finding the directory to both of these.
- Step 6: Open up Unity and go to Preferences. If you’re on a Mac, go to Unity > Preferences and if you’re on Windows then go to Edit > Preferences.
Add in the location of the SDK and JDK
- Step 7: Click on External Tools. Here is where you’ll add the path to both the Android SDK and the JDK. If you don’t add these in here now, you’ll be asked for them every time you build your game.
So far so good! Now, let’s setup our build settings.
- Step 8: Go to File > Build Settings click Android and press Switch Platform.
We now need to adjust the API; in order to build for the Gear VR we need to set the API level to 19 or above.
- Click "Virtual Reality Supported" and increase the API level to 19 or above
- Step 10: Click on Other Settings and you’ll find Minimum API Level under Identification. Choose an API level at 19 or above, I chose to use API Level 22.
- Step 11: Lastly, you need to enable Virtual Reality Supported. This is a checkbox directly above Identification.
Building for the Gear VR
Now that you have set up the software, let's get to the fun part: building!In order to build for the Gear VR, we’ll need a signature file and an Oculus Utilities package that we’ll import into Unity.
- Step 1: Go to Oculus Developer Tools and follow the process to get your Device ID and signature file. The signature file will be needed for your Unity project. If you have trouble getting your device ID you can also use this app on your Samsung phone.
- Step 2: Download the Oculus Utilities for Unity 5.
- Step 3: Drag both the Oculus Utilities and the Signature file into the Project Panel.
- Step 4: Place the Signature File within Plugins > Android > Assets folder which is part of the Oculus Utilities package we just imported.
Note that if you do not have the "assets" folder in Unity 5.3 create one and place your signature file in there. If this is not done properly you'll receive a security warning when trying to play your game on the Gear VR.
Place signature file in the Android > assets folder
- Step 5: Go into OVR > Prefabs and drag in the OVRCameraRig into the scene.
- Step 6: Ensure you have your Samsung smartphone plugged in via USB to your PC/Mac.
- Step 7: Build a simple environment an example project to build then go to File > Build and Run this will build your game and place the app on your Phone.
- Step 8: Navigate to the app on the smartphone and tap to open, you’ll receive a pop up message saying Insert Device to open this application insert your device into your Gear VR.
What's left? Connect your phone into your Gear VR headset and enjoy your new Gear VR enabled application! Don't forget to check out the VR Samples on the Unity Asset store along with the great resources on learning how to build for VR.
A demo from the Unity VR samples package
As you can see the process can be a bit complicated to start, but once you have everything setup it’s fairly easy to start building and testing your Gear VR applications. More video based training regarding the Gear VR will be available sometime next year. Until then - enjoy!