Part 2: Setting Up

Christiane Snyder
9/2/2016

Create a new Unity project called “EndlessRunner”.

 

Import the GoogleVR unity package into your new project. If you do not already have this unity package available on your computer, you can download it here:

https://developers.google.com/vr/unity/download

 

Download and import the starter package for this project below:

https://www.dropbox.com/s/3qywezf6l3xxsj9/EndlessRunnerStart.unitypackage?dl=0

 

This starter package will include a folder named “Endless Runner” with the following:

 

If you haven’t already, make sure that the project is for iOS or Android in your build settings.

File > Build Settings

 

Choose iOS or Android and click “Switch Platform” to confirm your selection.

 

Before closing this window, add the EndlessRunnerStarter scene by clicking “Add Open Scenes”. (If it does not show up, open this scene in the editor and then try again).

Once you have your GoogleVR package imported into the starter scene, drag the GvrMain prefab into the scene. (This can be found under “All Prefabs” in your “Favorites” folder)

Drag a GvrReticle (also present under “All Prefabs”) under the Main Camera in the GvrMain game object.

Your scene hierarchy should now look something like this:

 

Add a Physics Raycaster as a new component to the Main Camera. This will help us track where the player is gazing throughout the game.

 

The final step of setting up our scene is adding an Event System in the scene:

GameObject > UI > Event System

Remove the Standalone Input Module component from the initial EventSystem object (it’s not necessary for our project).


EventSystem should now look like this:

 

Add a Gaze Input Module and Touch Input Module:

 

 

NOTE:

The Gaze Input Module is included in the GoogleVR SDK and will help process the player’s gaze input events.


The Touch Input Module is included in the iOS Unity package and processes the user touching the devices screen. The Cardboard viewer’s trigger actually just hits the screen to create input events, so it utilizes this module.