How to Build a VR App in Unity for Beginners

By Sanket Thakur

Virtual Reality experience can be created using different means. But here, I will mainly be focusing upon Unity Editor to build our VR app and contents.

But prior to diving into VR using Unity, you need to learn how to navigate in Unity. I am sure most of you guys must have the software installed, but if not check this tutorial on how to install Unity . In this post, I will quickly give you a guide on how you can easily navigate in Unity.

VR App Development in Unity

Some of the basic controls that you can keep in mind for traversing through the scenes  are:

  1.  Left Mouse + W – to move forward
  2.  Left Mouse + S – backward
  3.  Left Mouse + A – left
  4.  Left Mouse + D – right
  5.  F – Focus

You can learn about basic controls by visiting Unity’s manual on hotkeys.

Awesome! Now, you are ready to dive into VR app development.  But you need to keep in mind that while you will be developing for VR you cannot create the whole project on your own. Either you will be creating the controls, designing scenes, creating objects and whatnot. So, VR app development is a vast field.

We will mainly use the designs imported, and then add scripts and controls to it. Since this is your first VR app, most of the things will be done prior to us working on them. Download the Unity project assets. It is a big file (~91MB ), so it will take some time.

Once downloaded, you can open the folder – you will find four or five folders. One of them will be assets folder.

Select the Asset folder

Assets : Select the Scene file named rollercoaster3.

Unity will start. It will ask you to downgrade to lower API levels. You can select it and keep a back-up.

(Note: If Unity crashes, open the downloaded folder again, and delete everything except Assets folder. Run again. Unity should run perfectly).

Once opened it will look like this.

vr app development tutorial

Doesn’t look good, right. So in order to fix that.

Go to Assets in project window > Standard Assets > Skyboxes . And double click Sunny Light (you can choose anyone) and select fix now for every option. I wish Unity would automatically do that. But, oh well!

vr app development tutorial

After every fix is applied, it should look like this.

vr app development tutorial

So, the way this works is that its a roller coaster and the cart moves along the path defined for it. Yes, the cart. If you can focus your camera to the cart.

vr app development tutorial

You can see two camera position for the game view. And the code for the game is mainly driven by this cart only. For this tutorial, you don’t need to worry much about the code.

(Note : If you are working with Occulus or Desktop related VR devices, you should disable the Dive camera by unchecking it from the inspector window). You can also delete the gyroscope component by selecting the main camera (the other camera) and in inspector window, right click and delete it.

Now, you can build the VR project. Note that your unity symbol should be adjacent to Android. If not you can select Android and switch platform.

vr app development tutorial

Now select player setting, and change the Bundle Identifier in the inspector window to anything ( Finally, run the app.

If this is your first time with Unity, it will ask you to locate Android SDK folder in your computer. Download Android SDK and locate it in the dialog while building the application.

You are now ready with with your first VR app. Congratulations!! You can try using other assets available on the internet. Its simple and if you are stuck anywhere. Do ping me. I will be ready to help.

Keep following me for more such easy tutorials on Augmented Reality or Virtual Reality. You can also connect with me on our online channel in slack to get more guidance and check out DIY Hacking’s VR & AR learning path to become an expert.


Recommended Posts

Leave a Comment

7 + 1 =

Start typing and press Enter to search