The Google VR SDK for Unity provides support for the Daydream controller, including the following capabilities:
Arm model: Mathematical model that predicts the location of the user's controller, based on the controller orientation and by using virtual shoulder, elbow, wrist, and pointer joints.
Input system: Integration with Unity's standard
EventSystem. Integrates with the laser and includes custom graphic and physics raycasters and reticle visualizations to allow users to interact with Canvas UI elements and game objects in your scene.
Reskinnable visualizations: Default visualizations that can be reskinned or used as is:
Controller: 3D model of the Daydream controller model that indicates which button the user is currently pressing and/or where the user is currently touching the controller touchpad.
Laser and reticle: Displays a laser and reticle to help users interact with the VR environment.
Tooltips: Customizable tooltips indicating how to use the controller buttons and touchpad.
The SDK includes several prefabs to support the Daydream controller and integrate with the Unity's Input Sytem.
Controller and Input System prefabs
To include controller support in your app, add the following prefabs to your scene:
|Prefab name||Location in scene||Description|
|GvrControllerMain||Anywhere in scene||Main controller prefab, responsible for managing controller state. Includes the
|GvrControllerPointer||Sibling to the Main Camera||Daydream controller prefab. Provides controller, laser, and reticle visualizations and serves as attachment point for tooltips and custom visualizations.|
|GvrEventSystem||Anywhere in scene||Drop-in replacement for Unity's Event System prefab. Includes the
|GvrEditorEmulator||Anywhere in scene||Editor play mode camera controller. Lets you simulate user's head movement with your mouse or trackpad.|
|GvrInstantPreviewMain||Anywhere in scene||Editor play mode Instant Preview controller. Lets you stream a stereo preview to your phone and use a physical Daydream controller in the editor.|
The resulting scene will look something like this:
GVR Graphic and Physics raycasters
The SDK includes drop-in replacements for Unity's standard raycasters. Both
replacement prefabs use the current
GvrPointerInputModule.Pointer instead of
the event camera to determine the ray origin and direction.
|GvrPointerPhysicsRaycaster||Drop-in replacement for Unity's PhysicsRaycaster. Raycasts take the reticle's radius into account.
Uses Physics.SphereCastNonAlloc to avoid unnecessary memory allocation.
|GvrPointerGraphicRaycaster||Drop-in replacement for Unity's GraphicRaycaster.|
Customizing controller visualizations
The GvrControllerPointer prefab is designed to be easily customized.
Add custom visualizations to the controller
Use one of the following options:
Customize the prefab directly.
Add one or more custom prefabs to the controller prefab's ControllerVisual >
GvrControllerVisual> Attachment Prefabs list.
The prefabs in this list will be cloned and attached to the controller at runtime.
Configure a raycast mode
Use the Hybrid, Camera, or Direct button to select a raycast mode and apply raycast mode defaults.
Customize default laser and reticle visualizations
To turn off the default visualizations:
- Disable or remove the prefab's Laser >
- Attach your own custom game objects or components to the prefab.
To customize the default laser and reticle visalizations' color, size, and behavior, adjust the prefab's subcomponents' properties in the inspector.
Customize controller tooltips
Add your custom tooltips prefab to the controller prefab's
GvrControllerVisual > Attachment Prefabs list.
Create your own tooltips or use one of the provided prefabs:
|GvrControllerTooltipsSimple||Performance optimized tooltips, rendered using a graphics texture.
To customize this prefab, make a copy of the prefab and replace or update the provided TooltipsSimple material to use a custom texture. Use the included
|GvrControllerTooltipsTemplate||Flexible dynamic tooltips, rendered using a Canvas UI.
To customize this prefab, make a copy of the prefab, expand the game objects under the prefab's Canvas game object and customize the tooltip Text components.
The provided prefabs include four tooltip labels:
These label names correspond to locations, relative to the controller, and the user's handedness preference. Use GoogleVR > Editor Settings > Handedness to test different user preferences while in the editor.
Customize arm model
The controller prefab's
GvrTrackedController > Arm Model property
specifies the arm model used by the controller. By default, the prefab uses its
GvrArmModel's settings assume that your user will hold and use the
controller like a laser pointer. If your app requires using the controller
for different actions, such as swinging a bat or catching a ball, adjust the arm
model settings appropriately.