Developing for Virtual Reality using the Unity Engine

May 27, 2016 written by Nishanth Babu


So far, in my blog posts I’ve talked about Virtual Reality and how it’s going to do amazing things to industries, but how do you get started developing for it?

One of the fastest methods to get into VR is to start learning how to use a game engine. In my last post,  I introduced the Unity and Unreal Engines that are being used for VR Development.

In this article we’ll be looking at the Unity Engine.

1. Learning Unity

Today, let’s dive in to the Unity Engine which is easier for beginners to get started with. Please note that before you begin, it is advisable to have a strong understanding of programming concepts, as Unity uses C# and JavaScript for its scripting.

The first thing I would suggest doing is visiting the Unity’s Tutorial and Documentation page. There are some really amazing tutorials to help you get started, I recommend the roll-a-ball tutorial. It covers most of the basics of the engine and introduces you to adding scripts and event handlers, as well. This will be useful later when you get started with VR Development.

Google Cardboard

2. Checking Phone Compatibility with VR

Once you’ve gotten a little more comfortable with Unity, you can start learning how to make simple VR apps for a smartphone, which can be then viewed using a Google Cardboard device. You can get one of these on Amazon for around Rs 300 – 600 ($5- 10).

The second thing you need to do is check if your Android or iOS device is capable of running VR apps. Free Fly VR has a list of all the phones that can support VR.

3. Setting Unity up for Google Cardboard

With that checked off, you are now ready to start developing for VR!

Head over to the Google Cardboard demo page at : Which will contain the following instructions alhong with documentation for the SDK (Software Development Kit).

1. Download the Google VR SDK for Unity. This has all the SDK files and the Google Cardboard demo.

2. Next download the Android SDK if you don’t already have it. The “SDK Tools Only” option is sufficient. After that follow the installation instructions and make sure you include “Get the latest SDK tools”.

3. Ensure that you have the latest version of Unity. When installing, please check the box for “Android Build Support” in the Download Manager when it prompts for Unity component selection.

4. Open Unity and create new 3D project.

Please note that the documentation on that page contains all the features of the SDK.

Google Cardboard SDK Demo

4. Exploring the VR demo

Once that’s done, boot up the Google Cardboard VR Demo in Unity and take a look at its code.

If you’re coming from a development background, you will notice that the demo features some event handlers for VR.

They are: OnGazeStart, OnGazeExit and OnGazeTrigger. These are similar to mouse events in JavaScript (onmouseover, onmouseexit, onmouseclick) but are triggered based on where the user is looking in the VR space.

Using these to start, we can create simple VR experiences.

5. Go forth and Create

After you have grown more acquainted with Unity and the Google SDK, I suggest making small applications to get started with becoming a VR developer! There are numerous resources in the form of tutorial videos on Youtube, Unity documentation and walk throughs that you can find on the internet to learn more advanced development techniques.

I’m very excited to see what you will come up with!