After creating a new Unity project, switch the Build Platform to iOS
Download and import the Google Cardboard iOS Unity package (excluding the DemoScenes folder):
Download and import the art assets package for this project here:
This package contains the galaxy skybox and asteroid models we will use.
After everything is imported, you can find a skybox named Stars by navigating:
Asteroids > Materials
To include this skybox as the game’s backdrop, open the Lighting panel and assign Stars as the Environment Light’s Skybox.
If you can’t find your lighting panel, you should be able to open it in your editor by clicking Window > Lighting on the top menu bar.
The basic camera included in the starter scene won’t work for VR, so delete it and drag the GvrMain prefab, which you can find in the All Prefabs folder, into your scene. GvrMain contains the main camera and accounts for all of the unique aspects of the rendering the player’s view for the Cardboard, specifically 360 stereo rendering.
Now, add a GvrReticle, which can also be found under All Prefabs, as a child of the GvrMain’s Main Camera. This will provide the player with a clear indicator of what is directly in their line of sight.
In the Main Camera’s inspector, set the Camera component’s Clear Flags property to Skybox to render our Stars skybox as the background image.Also add a Physics Raycaster as a new component to the Main Camera, which is necessary for Gaze Input to work properly.
Create a new EventSystem, which will help process the player’s input. We want to remove the Stand-Alone Module and add two new input modules, for Gaze and Touch input.
We’re now going to add four transparent quads as visual representations of the game’s boundaries.
Start by creating a new Quad in your scene and changing its transform values to the following:
Create a new transparent material named “Edge” for our boundaries and add it to this new Quad object:
We’ll simply duplicate, rotate and position this quad three additional times to create the three other borders
For the first duplicate, we’ll change the x position to -150 and its y rotation to -90.
Once again, duplicate the original quad once again and change this new boundary’s position to (0,0,150) and it’s rotation to all zeros.
Finally, duplicate the third quad and change its z position to -150 and its rotation about the y axis to 180.
Your scene should now resemble something like the picture below: