Introduction: 360° Photo Viewer Android App for Google Cardboard Made With Unity

About: Hacker from Berlin, Germany.

Build an Android app for Google Cardboard to view a 360° photo powered by Unity. Android SDK, Java DK, Android Developer Device and Google Cardboard required.

Step 1: Unity

Download and install unity personal.

Step 2: Google VR SDK for Unity Package

Download Google VR SDK for Unity.

Open Unity, create a new project and import the Google VR SDK for Unity package.

  • Assets > Import Package > Custom Package > Open the Google VR SDK for Unity package (gvr-unity-sdk-master/GoogleVRForUnity.unitypackage) > Import

Step 3: Equirectangular Panoramic Image

    Download an Equirectangular Panoramic image with 360° x 180° field of view.
    (you can find several on flickr like this one https://www.flickr.com/photos/jancbeck/16681739371...)

      Import and edit the Equirectangular Panoramic image in Unity.

      • Assets > Import New Assets, Import Equirectangular Panoramic image
      • Select the Equirectangular Panoramic image in the Project view.

      In the Inspector view:

      • Change the Texture Type to Cubemap.
      • Change the Mapping to Latitude-Longitude Layout (Cylindrical).
      • Apply

      Step 4: New Material

        Create and edit the Material. Assign the Equirectangular Panoramic image to the Material. Assign the Material to the Skybox.

        • Assets > Create > Material
        • Select the Material in the Project view.

        In the Inspector view:

        1. change the Shader to Skybox/Cubemap
        2. Cubemap (HDR) > Select Equirectangular Panoramic image

        • Drag and Drop the Material from the Project view into the Scene view.

        or

        • Window > Lightning

        in the Lightning view:

        • Environment Lightning / Skybox, Select the Material

        Step 5: Main Camera

        Add the stereo controller from google vr and update stereo cameras.

        • Select Main Camera in the Hierarchy view.

        In the Inspector view:

        1. add component > GoogleVR > StereoController
        2. Stereo Controller (Script) > Update Stereo Cameras

        Step 6: Player Settings

        Change Build Identifiers and Screen Orientation in the Player Settings.

        "Bundle Identifier: The string used in your provisioning certificate from your Apple Developer Network account(This is shared between iOS and Android)"

        "Default Orientation, Landscape Left: The device is in landscape mode, with the device held upright and the home button on the right side."

        • Edit > Project Settings > Player

        in the Inspector View:

        • Android Settings > Other Settings > Identification > Bundle Identifier (replace com.Company.ProductName with your data, like com.MyCompany.MyProduct)
        • Android Settings > Resolution and Presentation > Orientation > Default Orientation > Landscape Left

        Step 7: Connect Android SDK and Java DK to Unity

        Add the Android SDK path and Java DK path to Unity.

        "The first time you build a project for Android (or if Unity later fails to locate the SDK), you will be asked to locate the folder where you installed the Android SDK. Select the root folder of the SDK installation."

        • Unity > Preferences > External Tools > Android > SDK > Browse > Choose the root folder of your Android SDK.
        • Unity > Preferences > External Tools > Android > JDK > Browse > Choose the root folder of your Java DK.

        Step 8: Build

        Connect your Developer Android Device to your Computer.

        • File > Build Settings > Android > Build and Run
        • Save

        Step 9: Enjoy the 360 View

        Disconnect your Android Developer Device from the cable and put it in your favorite Google Cardboard.

        Turn around and Enjoy the view.