VR implementation in android using Unity3D

Learning in style

Hello folks, We at Headstart, hope to implement all possible exciting features to improve our learners experience better and novel every day. In most cases moving forward with new technology and adapting to the gadgets out there is challenging. But hey, we are not quitters. With the first step here onwards, we shall be explaining our experience, how we learned and what we did for you follow with more simplified ways.

VR implementation in android using Unity3D

Today I’m going to explain about, taking Virtual Reality (VR) inside in to the Android. So what is VR? VR is a computer technology that exist today, to create simulated environment that feel more alive to user. So the user can be interact with virtual 3D objects and can experience a simulated sense like 3D vision and hearing.

So first we will look at the basic ingredients to cook todays simple VR. First of all we need the Android OS device and a good computer with the Unity 3D game engine installed. Then we need a device like Google Cardboard to test it in a real-world. So now we can start mixing all to gather.

First you have to download the “Google VR SDK” from https://developers.google.com/vr/unity/download.

Now open up the Unity3D engine. I’m currently using Unity 5.3.3f1 (64-bit) for this tutorial. Get a new unity project.

Choose a project name, a saving location, mode as “3D” and, from asset packages choose “Environment” package. By pressing “Create project” you can create a new project and it’ll automatically generate a new scene. Now from the “Assets” menu you can choose “Custom Package”. It’ll show you the package selection dialog and you can locate the Google VR SDK package from it.



It’ll show you the most import menu, from here you can choose whatever the platform you need.



After importing the package now you have the CardboardMain.prefab file. It will make a stereoscopic view by using two cameras at same time. So it’ll work like your two eye balls. Now we can remove the old default camera. Go to Hierarchy panel and delete the “Main Camera”. So this is the basic pre-setup process for the Cardboard view in Unity 3D.

Now let’s test what we done. You can push the play button to get preview first before publish it into device.

First of all we can only see a blue sky area with gray bottom. So we going to add some object into the space. I’m going to add terrain panel and a cube on top of it.

After that select terrain, then select paint texture tool. Push Edit texture and choose “Add Texture…” Select grass texture for the “Albedo Smoothness” slot.


After that add a cube and now the output look like this.


Ok, now we are good to go. But for feel alive, I will add a rotating script to the cube. Create a new C# script, name it “Rotator.cs” and put below lines and give some speed values to rotate.

using UnityEngine;
 using System.Collections;
 public class Rotator MonoBehaviour {
     public float xspeed = 0.0f;
     public float yspeed = 0.0f;
     public float zspeed = 0.0f;
     // Use this for initialization
     void Start () {
     // Update is called once per frame
     void Update () {
             xspeed * Time.deltaTime,
             yspeed * Time.deltaTime,
             zspeed * Time.deltaTime


Now we can build the apk file. First go to build setting from file menu. From there choose Android as the platform and push “Add open scenes” button to add the scene that you already created. Before build we have to put android unique identifier. So using “Player setting” button go to advance options and change the Bundle identifier. Then you can quickly build the apk by using “Build” button.

It’s clear that initial implementation of the cardboard view is generic, but it is the most tricky and interesting part of it. The animation and aliveness is you call. With experience you’ll learn to make our imagination more real with this.

Ok guys, that’s it for now. Will meet another exiting topic with next time. See you all.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s