Quick Start Guide: Gear VR + Unity

Large
Last week, we took a close look at the Gear VR to see what the buzz is all about. Today, Jonathan Gonzalez takes it one step further and looks at what it takes to use the Gear VR for your own content.

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.

Getting Started

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.

image06  

  • 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.

image01

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. 

  • Step 9: Click on Player Settings, then click on the Android logo image00

  • 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. 

image05

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.

Final Steps

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. GearVR_QSG

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!  

  • v
    v0rt3x

    I hope to upgrade to the s7 and get the free gearVR
    http://www.geek.com/deals-2/geek-deals-pre-order-a-samsung-galaxy-s7-or-s7-edge-get-a-gear-s2-or-gear-vr-for-free-1648231/

    I'd like to see more posts and how to work with controllers.

  • Large
    Jonathan Gonzalez

    Hah, I wish I knew the S7 was coming out so soon and with the Gear VR at that. Oh well, luckily the Gear VR still works with the S6 phones.

  • m
    mianel

    Nice post, but how can I have access to the proximity sensor for Gear VR?

  • Large
    Jonathan Gonzalez

    As far as I know there isn't currently a way to access it as it's something Samsung hasn't made directly available through their SDKs. I believe the Oculus team are looking at getting something implemented for this. Not sure what you're trying to use it for, but there's more than likely a workaround that can be done via scripting.

  • w
    Robert England

    Hello, This looks wonderful, but is very old. The interaction between Unity, Oculus, Gear VR seem to change werkly,., Is there any newer ino you can give? Have do done any uodated quickstarts? 5 werks in I have yet to find a single resource that got me from Unity to Gear VR. I'm near suicidal with frustration. There are endless guides, they all refer to different versions of Unity, some say install Ovr, some say avoid it, endless contradictions. This has become a nightmare. I have done a Huge list of requirements, but never seem to get to the actual point of going into unity and making a simple scene then seeing on Gear vr.. I have Unity 5.3.5 f1 a Note 4, Gear VR,.. etc.... PLEASE PLEASE HELP! I CAN'T GET THERE FROM HERE! ;~)

  • Large
    Jonathan Gonzalez

    The OVR files are optional, they're just a collection of scripts/assets that Oculus provides for testing and trying out some of their example scenes with the Gear VR. All you really need is to set the platform to Android with "use virtual reality" enabled. I believe you also need the ossig file for your specific phone within the correct folder hierarchy (it's case sensitive). I'm not sure how much of this has changed as I don't use the Gear VR anymore. I don't know where you're getting stuck but just stick to what I mentioned here and build a basic scene.

  • s
    slashmit

    Hey quick question here, i have installed the Android sdk, gone through the setup process in the build settings, and imported the oculus utilities; however, in the plugin folder there is not an Android folder for me to place the signature file into?? thoughts?

  • s
    slashmit

    Can i just add in the folders and it will be alright? sorry forgot to add that

  • s
    slashmit

    and retract it as i missed the part where you said to just do that. thanks again super excited to get into VR!

  • Large
    Jonathan Gonzalez

    Have fun with the GearVR! VR is fun to work with, if you have any questions I'll do my best to answer them.

Your was successfully !