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
Unity LTS release 2017.4 or newer with Android Build Support.
GoogleVRForUnity_*.unitypackagefrom the releases page.
For more detailed installation instructions, see Quickstart for Google VR SDK for Unity with Android.
Using the controllers after setupFluorescent 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.
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
DemoInputManagerscript switches the laser pointer to the controller on button down of
DemoObjectController6DoFcomponent demonstrates usage of the experimental 6DoF controller's grip button to "grab" a floating object.
- The GvrBetaControllerPointer prefab uses the
GvrBetaControllerVisualMulticomponent to switch controller meshes at runtime and change controller transparency based on positional tracking status.
To try this demo scene:
- Create a new Unity project.
- Switch your project's Build Platform to Android.
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
Import the Google VR SDK for Unity (
GoogleVRForUnity_*.unitypackage) that you downloaded above into your project.
In Unity, open the
Verify that the Build Settings > Scenes in Build list is either empty, or contains only the currently open Hello6DoFControllers scene.
Build and Run the app on your device.
Experimental 6DoF controller button mapping
For experimental 6DoF controllers, each button is mapped to either
InputButton.Right. As such, only
Trigger will trigger UI component pointer events:
|Controller button||Triggers UI component
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
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:
GvrControllerButtonmask of buttons that went down to trigger the event
GvrControllerInputDevicethat triggered the event