We recently covered getting started in GearVR development using Samsung’s GearVRf library and the Unity Engine. Today we are going to finish it off with coverage of getting started using the Unreal Engine. As with the Unity tutorial, although this is focused on the GearVR, most of the instruction should be equally valid for all Oculus Rift devices. Of all the game engines, the Unreal was actually the easiest engine to get up and running with the GearVR.
There are a few pre-requisites before getting started:
- A Samsung S6/Edge/Note4 phone with developer mode enabled.
- The Android SDK with Platform 19 or 21 installed
- An Oculus Developer Account
- Once you have an account, you need a key for your phone
- Unreal Engine 4.7+ (Using 4.10.1 in this example)
There is a video based version of this tutorial available here and embedded below.
Configuring Unreal Engine
In order to be able to run code on your phone we need to add the Oculus Signature file to the application. With Unreal Engine, this is configured at the engine level which is handy as you only have to configure it once for and it will work with all future projects. If you haven’t already, sign up for an Oculus developer account, then get your key. This will generate a file that we need to copy now.
The directory you want is [Unreal Install Dir][Version]EngineBuildAndroidJavaassets. In my install it was:
Creating a Project
You can use just about any settings, but these ones work well.
This will mostly just set presets that are mobile friendly. Click Create Project when ready.
Configuring Your Project
If not done already, load your project in Unreal Engine, then select Edit->Plugins:
Now verify (or turn on) the GearVR and Oculus rift libraries and plugins, like so:
Now select Edit->Project Settings:
Locate Android SDK on the left hand side then on the right configure the location of your Android SDK install.
Now go to Android, set the Android minimum level then click the Configure Now button:
While in the Android settings, be sure to enable GearVR support!
Build Your App
Now build and package for Android, in the File Menu, select Package Project->Android->Android (ETC2):
Pick a location for the generated APK then Ok.
For the record, Unreal Engine Android builds are really really really slow.
When complete this will generate the APK file to run on your phone, as well as a pair of BAT files to quickly deploy to your device. The noOBB batch file doesn’t copy data, only the updated executable. Keep in min,d, you need to have your device either tethered or running wirelessly over adb to deploy. This means removing it from the GearVR, which is an annoying process. If you don’t need to fully test VR functionality, it might be faster to work in developer mode. [Link soon]
Video