So, you have a Samsung Gear VR, and you want to develop for it using Unity?
Great! Then this post is for you! I’ll show you how to get up and running with the minimum of fuss. Just follow the instructions below…
A few things before getting started…
I went through this setup procedure with a Gear VR (Innovator Edition) headset, paired with a Samsung Galaxy S6 phone. Don’t worry if you own another version of Gear VR (or Samsung Galaxy phone); the setup should be pretty much identical.
The instructions were written for a Windows PC (I’m using Windows 10). However, you should find that even if you are developing on a Mac, the process should be fairly similar.
I am assuming, however, that your phone is already set up to work with your Gear VR, and that you have installed and played (at least) a couple of the VR experiences available on ‘Oculus Home’ :
First of all, you need to install the latest version of the Java SE Development kit on your PC.
In your web browser, go to: http://java.oracle.com In the main header menu, mouse-over ‘Downloads’ , then click on the Java for Developers option (under ‘Popular Downloads’). You should now be on the Java SE Downloads page, click on the JDK ‘DOWNLOAD’ button.
You should now be on the Java SE Development Kit 8 Downloads page. Go to the sections relating to the latest version of the ‘Java SE Development Kit’, click the ‘Accept License Agreement’ radio button and then click on the correct jdk download link for your operating system ( I clicked the ‘jdk-8u112-windows-x64.exe’ link ).
Once the executable has downloaded, run it. The Java SE Development Kit installer will launch:
Important: Please make a note of the Installation folder for the Java SE Development Kit (or JDK). Unity will ask for the folder location, the first time you run a build.
Accept all the standard settings and install.
STAGE 2: Install the Android SDK on your PC.
Unity uses the Android SDK (Software Development Kit) in order to create a Gear VR build. The simplest way to install the SDK, is to install Android Studio. We will do this now…
On the next page, tick the check-box to accept the terms and conditions, and then click the ‘Download Installer…’ button.
Once the Installer has finished downloading, run it. The Android Studio Setup wizard should launch.
You can accept all the default settings. However, when you reach the Choose Install Location section, make sure you make a note of the ‘Destination Folder’ (Unity will need to know this during the build process).
STAGE 3: Configure your phone for app development.
With your phone on, and detached from your Gear VR headset, tap on the ‘Apps’ icon on the Home Screen.
Next, click on the ‘Settings’ icon. In the ‘Settings’ menu, scroll down until you find the ‘About device’ option and tap it. On the ‘About device’ screen, scroll down until you can see the ‘Build number’ item. Now, tap on ‘Build number’ 7 times! This “secret” action will unlock ‘Developer options’ on your phone!
Go back to the main ‘Settings’ menu. You will notice that a new item, called ‘Developer options’, has appeared above ‘About device’. Tap on ‘Developer options’.
On the ‘Developer options’ screen, switch on ‘USB debugging’ (the switch should turn green). An ‘Allow USB debugging?’ prompt will appear, tap ‘OK’ to confirm.
Now, connect your phone to your PC via the phone’s USB cable.
Another prompt asking ‘Allow USB debugging?’ will appear. You will notice a checkbox with the text ‘Always allow from this computer’. It is important that you tick this box, and then tap ‘OK’.
STAGE 4: Create an Oculus Signature file.
In order for you to be able to play your Unity app on your Gear VR, you will need to include an Oculus Signature File (osig) in your project. Here’s how to create one …
On your phone, go to the Google Play Store and install a free App called: SideloadVR DeviceID
Now, launch the SideloadVR DeviceID App:
You will notice an alpha-numeric string under ‘Your Device ID is:’ . Make a note of this Device ID somewhere, you will need it shortly to generate your Oculus Signature File.
Note: You will need to be signed up and logged in as an Oculus Developer, in order to use the OSIG Generator on this page. If you have not yet signed up for an Oculus Developer account on this site, please do so now. Ensure that you are logged in.
On the OSIG Generator page, type your phone’s Device ID into the field provided (you should have noted this down in the previous step).
Click on the ‘Download File’ Button.
An Oculus Signature File (osig) will be generated and downloaded. It will be named: oculussig_[Device ID]
Save this file somewhere, where you can find it easily. You will need it later, to ‘sign’ your Unity/Gear VR projects.
From the menu at the top of the page, click ‘Get Unity’. You will be taken to a download page.
You have the option of downloading either the free or professional versions of Unity. The free version of Unity will allow you to develop for Gear VR, so unless your situation excludes you from the terms of the free license, you will probably want the ‘Free Download’ option (you can always upgrade to a pro license later). Click on the Download button.
On the next page, click the large ‘Download Installer’ button.
The Unity Download Assistant should now download. At the time of writing, this file is called ‘UnityDownloadAssistant-5.5.0f3.exe’. Run it now.
The Unity Download Assistant should now launch.
Click ‘Next >’, accept the Terms & Conditions…
You should reach a stage where you are prompted to ‘Choose Components’.
Make sure you tick ‘Android Build Support’ (it will be unchecked by default), then click ‘Next >’.
You should then be prompted to ‘Choose Download and Install locations’ (you can leave the defaults). Click ‘Next >’. The installation process should then begin.
Launch Unity 5. The First time you do this, you may be be presented with some Setup steps, prompting you to Sign in to a Unity account and/or to select a license (you’ll probably want the ‘Unity Personal Edition’ option!). Complete these steps.
STAGE 6: Create a Gear VR Project in Unity.
You should be presented with this project launch window:
With the ‘Projects’ tab selected, click on the ‘NEW’ button.
You will be asked to supply a ‘Project name’ and ‘Location’ for your new Unity project.
Fill in these fields, make sure the ‘3D’ option is selected, and click the ‘Create project’ button.
Your new project will be created and opened in the Unity 5 Editor.
For those familiar with Unity, you will know that every Unity project contains an ‘Assets’ folder. The ‘Assets’ folder is where all your project’s assets (i.e. audio, graphics, scripts, scenes …) are created and saved. The ‘Assets’ folder (and it’s contents) exist within the project’s file structure, which is also reflected and accessible from the ‘Project’ panel in the Editor.
In order for your VR app to run on your Gear VR, you will need to add that Oculus Signature File (that you generated earlier), to your project.
Before you do this however, you will need to create a specific file structure within the ‘Assets’ folder.
Firstly, in the ‘Assets’ folder, create a sub-folder called ‘Plugins’. Next, within ‘Plugins’, create an ‘Android’ folder. Finally, within this ‘Android’ folder, create a folder called ‘assets’. Your ‘Assets’ folder structure should now be as follows:
Now you need to find that Oculus Signature File (osig) that you previously generated, and copy it into:
Reminder: The Oculus Signature File will be named like this: oculussig_[Device ID]
Your Unity project should now look something like this:
Now, lets give ourselves something to look at in VR…
From the top menu and select: GameObject → 3D Object → Capsule
Move the newly created ‘Capsule’ object in front of the ‘Main Camera’, so that it is clearly visible in Camera’s view.
This is all we are going to do as far as our scene goes, so let’s save it.
From the top menu, select: File → Save Scene
You can save the scene in the root ‘Assets’ folder, I saved it simply as ‘scene’ ( scene files have a .unity extension). (This is probably a good point to save the entire project also.)
STAGE 7: Build and Run your Gear VR App.
Ok, it’s time to actually create a build. Make sure your Android phone it connected to your PC via it’s USB cable.
Firstly, from the top menu, select: Edit → Preferences…
The Unity Preferences Window should appear. From the sidebar, select the ‘External Tools’ option.
For Unity to be able to create a build, it needs to know the location of both the Android SDK and the Java JDK (you should have made a note of these previously). You will notice two text-fields under Android, enter the relevant paths there.
For reference, my paths are as follows: (Android) SDK: C:\Users\milan\AppData\Local\Android\sdk (Java) JDK: C:\Program Files\Java\jdk1.8.0_112\
Next, from the top menu, select: File → Build Settings…
The Build Settings Window should appear. From the Platform options, select ‘Android’, then click on the ‘Player settings…’ button.
The Inspector Panel should now be populated with Player Settings. On the Inspector Panel, ensure that the Android tab is selected.
Now, tick the ‘Virtual Reality Supported’ check-box.
You must also select the a ‘Minimum API Level’ of at least 19. To be safe, let’s select the very latest API. At the time of writing this is: Android 6.0 ‘Marshmallow’ (API level 23)
Go back to the Build Settings Window. Click on the ‘Add Open Scenes’ Button. This will add our current scene to the ‘Scenes In Build’ list.
Now, click the ‘Build an Run’ button.
You will be prompted to pick a location for your App build (I like to create a folder in the root of the project called ‘Bin’, as my Build location, but it’s up to you). You will also need to enter a file name for your App. I called mine ‘test’ (you will note that the extension for an Android App is .apk)
The build process should then commence…
Once the build is complete, a new App (called ‘Test Gear VR’) will be installed on your phone. An ‘Insert device’ prompt should also appear on your phone.
Insert your phone back into your Gear VR, your App should start automatically once you don the headset.
(If the ‘Insert device’ prompt is not showing, tap the ‘Test Gear VR’ App Icon)
After the brief Unity Splash screen, you should see the ‘Capsule’ scene in all its VR glory!
I was working on a project some months ago, where the client had a showreel DVD with a number of videos on it. They needed a menu screen/window to pop up automatically whenever the DVD was inserted into a Windows PC. The Menu window was to be fairly straightforward, having a set of buttons, each of which was to trigger the playback of a different video. However, the client wanted the menu buttons to start each video, in whichever video-player was set as the default for that system.
I decided to code the app in C++, using the Cinder Framework (as the Menu needed some graphics and audio).
I came across various methods for opening files externally, via their default program. However, the simplest method was to use the ‘Shell Execute’ command.
The code snippet below, shows this method in action: it simply opens a video file in whichever program is assigned to open it by default.
So what is a Neural Network? Rather than embark upon a lengthy description here, I will instead refer you to a couple of useful sites (linked below). These will provide you with an introduction into Artificial Neural Networks (ANNs) and their uses:
The project contains C++ classes for creating a Multi-Layer Perceptron Network. I have implemented these classes in an example Win32 Console application (compiled using Visual Studio 2012). You are free to use this code under a MIT License.
Below is a diagram which illustrates an example Perceptron Network that can be configured using the MLP Network classes.
Multi-Layer Perceptron networks are probably the best know and most widely used of all Artificial Neural Networks. They are often used to tackle problems such as hand-writing or voice recognition. An MLP net is constructed by arranging perceptron units together in a series of ‘layers’. The neurons in each layer are connected to the neurons in the adjacent layers in a hierarchical fashion (the neurons outputs from one layer supply the inputs for the next). Typically, each neuron within a layer will have an input ‘dendrite’ connected to the output of every neuron in the previous layer (this is known as a FULLY-CONNECTED network, which is the method employed in my classes). The bottom layer is known as an ‘input layer’ and usually receives input data from sensors or some other input device(s). Further documentation of my perceptron classes can be found here: neural.pdf.