Get started with Google VR in Unity on Android

Use Unity 5.6 to build Daydream and Cardboard apps for Android. This guide shows you how to set up Unity for Google VR development and build a demo scene.

Set up your development environment

Hardware requirements:

Software requirements:

  • Install Unity 5.6 or newer.

    Make sure that the "Android Build Support" component is selected during installation.

    For more installation details, see Unity's Android SDK setup guide.

  • Download the latest GoogleVRForUnity_*.unitypackage from the Google VR SDK for Unity releases page.

    The SDK download includes the following Unity demo scenes:

    Scene Description
    GvrDemo Simple VR game in which you find and select a cube.
    KeyboardDemo Shows keyboard input on a UI canvas.
    PermissionsDemo Shows a correct user permissions request flow.
    ScrollingUIDemo Shows paginated scrolling that you control with swipes on the Daydream controller touchpad.
    VideoDemo Shows various ways to use stereo or 360º video through local playback or remote streaming.

Create a new Unity project and import the SDK

  1. Open Unity and create a new 3D project.

  2. Select Assets > Import Package > Custom Package.

  3. Select the GoogleVRForUnity_*.unitypackage file that you downloaded.

  4. In the Importing Package dialog, click Import. Accept any API upgrades if prompted.

Configure build settings

  1. Select File > Build Settings.

  2. Select Android and click Switch Platform.

  3. In the Build Settings window, click Player Settings. Configure the following settings:

    Setting Value
    Player Settings > Other Settings > Virtual Reality Supported Enabled
    Player Settings > Other Settings > SDK Click + and select Daydream or Cardboard.
    Player Settings > Other Settings > Minimum API Level Daydream: Android 7.0 'Nougat' (API level 24) or higher.

    Cardboard: Android 4.4 'Kit Kat' (API level 19) or higher.

  4. Close the Build Settings window.

Preview the demo scene in Unity

  1. In the Unity Project window, go to Assets > Google VR > Demos > Scenes. Open the GVRDemo scene.

  2. Press the Play button. In the Game view you should see a rendered demo scene. Note that although the scene here is monoscopic, the rendering on your phone will be stereo.

  3. Interact with the scene using simulation controls.

    Type Simulated action What to do
    Head movement Turn your head Hold Alt + move mouse
    Tilt your view Hold Control + move mouse
    Cardboard input Button press Click anywhere in the Game view.
    Daydream input Change controller orientation Hold Shift + move mouse
    Click touchpad button Hold Shift + click left
    Click app button Hold Shift + click right
    Click home button to recenter Hold Shift + click middle
    Touch the touchpad.
    To see the controller, tilt your view down.
    Hold Control
    Change the touch position on the touchpad.
    To see the controller, tilt your view down.
    Hold Control + move mouse

  4. (Optional) Daydream: In addition to mouse input controls, you can use a real Daydream controller with Instant Preview.

Prepare your device

Build and run the demo scene on your device

  1. Connect your phone to your computer using a USB cable.

  2. Select File > Build and Run. Unity builds your project into an Android APK, installs it on the device, and launches it.

  3. Put the phone in your viewer and try out the demo.

Next steps