November 6, 2019 update:
  • There's a new open source Cardboard SDK for iOS and Android NDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning. A corresponding Unity package (SDK) is planned for a future release. We recommend that all developers actively building for Google Cardboard migrate (iOS, Android NDK) to the new Cardboard SDK.
October 15, 2019 update:
  • The Daydream View VR headset is no longer available for purchase. However, you can continue to use the existing Google VR SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.

Getting started with experimental 6DoF controllers in Unity

This guide gives you high-level instructions for setting up Google VR development with Unity and building a demo Daydream app that works with the experimental 6DoF controllers and faceplate for the Lenovo Mirage Solo with Daydream.

Set up your development environment

Hardware requirements:

Software requirements:

For more detailed installation instructions, see Quickstart for Google VR SDK for Unity with Android.

Using the controllers after setup

Fluorescent lighting and HTC Vive Lighthouses are both known to interfere with tracking. Turn off the Vive Lighthouse if you have one, or move to a room with different conditions.

Beta APIs

Getting started with the experimental 6DoF controllers

Hello6DoFControllers demo scene

The Hello6DoFControllers demo scene included in the SDK demonstrates new experimental 6DoF controller features:

  • Demonstrates use of two controllers. The DemoInputManager script switches the laser pointer to the controller on button down of TouchPadButton, Trigger, Grip, or App.
  • The DemoObjectController6DoF component demonstrates usage of the experimental 6DoF controller's grip button to "grab" a floating object.
  • The GvrBetaControllerPointer prefab uses the GvrBetaControllerVisualMulti component to switch controller meshes at runtime and change controller transparency based on positional tracking status.

To try this demo scene:

  1. Create a new Unity project.
  2. Switch your project's Build Platform to Android.
  3. Configure Unity build and player settings:

    Setting Value
    Player Settings > XR Settings > Virtual Reality Supported Enabled
    Player Settings > Other Settings > SDKs Click + and select Daydream
    Player Settings > Android > XR Settings > Virtual Reality SDKs > Daydream > Positional Head Tracking Required
    Player Settings > Other Settings > Minimum API Level Android 7.1.1 'Nougat' (API level 25) or higher or higher
    Player Settings > Other Settings > Package Name Your app's package identifier
  4. Import the Google VR SDK for Unity (GoogleVRForUnity_*.unitypackage) that you downloaded above into your project.

  5. In Unity, open the GoogleVR/Beta/Demos/Hello6DoFControllers/Scenes/Hello6DoFControllers scene.

  6. Verify that the Build Settings > Scenes in Build list is either empty, or contains only the currently open Hello6DoFControllers scene.

  7. Build and Run the app on your device.

Experimental 6DoF controller button mapping

For experimental 6DoF controllers, each button is mapped to either InputButton.Left or InputButton.Right. As such, only TouchPadButton and Trigger will trigger UI component pointer events:

Controller button Triggers UI component
pointer events?
PointerEventData.button returns
TouchPadButton Yes InputButton.Left
Trigger Yes InputButton.Left
App No InputButton.Right
Grip No InputButton.Right

Controller emitted pointer events

Pointer events are handled differently, depending on whether you are using a Daydream (3DoF) controller or experimental 6DoF controller.

Controller button Emitted pointer events
Daydream (3DoF) controllers
Emitted pointer events
Experimental 6DoF controllers
TouchPadButton PointerDown, PointerUp, PointerClick PointerDown, PointerUp, PointerClick
Trigger n/a PointerDown, PointerUp, PointerClick
Grip n/a PointerDown, PointerUp, PointerClick
App none PointerDown, PointerUp, PointerClick

Accessing controller specific pointer event data

PointerEventData generated by Daydream (3DoF) controllers and experimental 6DoF controlers is of type GvrPointerEventData and contains additional event information exposed through PointerEventData extension methods:

  • GvrGetButtonsDown() returns the GvrControllerButton mask of buttons that went down to trigger the event
  • GvrGetControllerInputDevice() returns the GvrControllerInputDevice that triggered the event

Additional documentation