Get Started with Unity for iOS

This page describes how to build and deploy the demo scene included in the Google VR SDK for Unity, presuming little prior Unity experience.

If you are looking for instructions for building a VR app on Android with Unity, see the Getting Started with Unity for Android page.

First, we'll be building a simple game for VR called Treasure Hunt, which will show you the following concepts in Unity:

  • Using the GvrEditorEmulator prefab to set up a stereo camera rig that tracks the user's head orientation.

  • Handling trigger input events.


  • iPhone version: The Google VR SDK for Unity only works with iPhone 5 and later, running iOS 8 or higher.

  • Unity version: The Google VR SDK for Unity requires Unity 5.6. If you're not already set up to develop for iOS in Unity, we'll be downloading and setting it up in a later part of this guide.

Set up Unity for iOS

If you have never written applications for iOS before, you will have to set up a developer account with Apple. We recommend you follow Unity's instructions for setting up Unity iOS development, which will also involve downloading XCode:

Set up the Google VR SDK for Unity

Whether you are already familiar with iOS development on Unity, or have just set everything up for the first time, let's download and build the Google VR demo scene.

  1. Download the Google VR SDK for Unity. This includes the SDK files and the demo files.

  2. Download and install the latest version of Unity. When installing, make sure you check the box for "iOS Build Support" in the Download Manager when it prompts for Unity component selection.

  3. Open Unity, creating a new 3D project.

Import and preview the demo scene

  1. Import the Unity package by going to Assets > Import Package > Custom Package. Select the GoogleVRForUnity unitypackage where you downloaded it and click Open. Make sure all the boxes are checked in the Importing Package dialog and click Import. You may be warned that the APIs will be automatically upgraded. Accept it and continue if it happens.

  2. In the editor's project pane, navigate to the Assets > Google VR > Demos > Scenes folder and open the GVRDemo scene. You should see a scene with a cube floating in a gray room.

  3. Press Play, and you should see the game view showing a stereo rendering of the scene.

    Press the Control key on your keyboard and move your mouse back and forth to tilt your view. You can also press the Alt button on your keyboard and move your mouse to pan around your view of the VR environment.

Build and run the project on an iOS device

There are a few things you'll need to set up before the first time you build.

  1. Open up the Build Settings by going to File > Build Settings.

  2. Select iOS under Platform. After selecting iOS, click the Switch Platform button.

  3. Click Player Settings to open the PlayerSettings panel in the Inspector.

  4. In PlayerSettings, at the bottom under Settings for iOS, click Resolution and Presentation to expand that panel. Set the Default Orientation to Auto Rotation, and then uncheck all of the Allowed Orientations for Auto Rotation except for Landscape Left.

  5. Click Other Settings to expand that panel and find the Bundle Identifier field. Enter a valid package name for your application (such as com.mycompany.cardboarddemo) that follows the naming rules for Java packages and/or .Net namespaces. Typically this is of the form: com.[yourcompany].[appname]

  6. Plug in your iOS device via USB, and click Build and Run.