Daydream is the high-quality VR platform by Google. It has been presented at Google I/O 16 from Clay Bavor. Today this platform is compatible with only one Headset: Google Daydream View a sort of Cardboard 3.0 with a 3DOF Controller. Any only a little subset of high-end smartphones is compatible with this platform.

Daydream View + Google Pixel

For sure more compatible smartphone are yet to comes but the most exciting wait is for Daydream Standalone VR Headsets:

Daydream standalone VR Headset

A brand new HMDs presented at Google I/O 17 working without smartphone and compatible with the Daydream API that will be available for the end of the year.

So I think NOW it’s time to understand how to develop for this high potential platform!

Let’s start with the basic:

Download Unity 2017.1.1 at https://store.unity.com/

Unity is a very common Game Engine also used to develop VR experiences, it has native support for Cardboard and Daydream but for power-up development we need the Google VR SDK.

Download the Google VR SDK https://github.com/googlevr/gvr-unity-sdk

Now let’s create!

Open Unity and Create a new project:

Now Import the Google VR SDK in our project selecting Assets->Import Package -> Custom Package

and selecting GoogleVRForUnity_x.xx.x.unitypackage you downloaded.

Import everything

et voilà, we are all set. Ready to create our first Daydream VR experience.

Create a directory for our Scenes (Let’s be clean)

Create our Scene

Now open our scene and add into it a GvrEventSystem prefab from Google VR SDK

the GvrEventSystem will extend the Unity Event System to handle the input from our Controller

Now create and empty object in the scene, let’s call it Me or Player and move the Main Camera in it (remember to reset its position)

This object will be you, your eyes, your head and your hand in your experience :)

The Main Camera will be your eyes and head but the Hand?

Look for the GvrControllerMain prefab and add it into the scene

Look for the GvrControllerPointer prefab and add it into Me

This will be your hand in VR :) by the Daydream Controller

To make it interact with the 3d objects in our scene we need another component GvrPointerPhysicsRaycaster and we need it in our Main Camera

Click on Main Camera and add a GvrPointerPhysicsRaycaster component to it

Now we had Hand in VR but we need something to interact with.

Create a Sphere and move it away from our Main Camera

This will be our interactable object, let’s assume we want the Sphere to change color when our pointer select it

Add a script component to the Sphere, let’s called it SphereBehaviour.cs and implement a method like in the picture

a simple method accepting a boolean and changing the material color as the boolean parameter is changing.

Add an Event Trigger component to the Sphere

The Sphere Event Trigger

define the behaviour of two events Pointer Enter activating SetGazedAt with True flag; Pointer Exit activating SetGazedAt with False flag.

Now let’s build it up!

Select File -> Build Settings and Add the open scenes.

Switch to Android Platform

Select Player Settings and in Other Settings, enable Virtual Reality Supported selecting Daydream as supported SDK; change the package name as you want and change the Minimum API Level to level 24 (Android 7.0)

Link our smartphone to the USB and…

Let’s hit “Build and Run”

When the app is started you will see this screen

Do as your phone is saying and your app will start

Your first Daydream VR app

Gotcha! You can move your VR controller with your real Daydream controller, entering the laser in the Sphere and exiting it make it change its color!

This is your first step in Daydream VR world. Stay tuned for more…