Build a Cardboard Demo – Android

Prerequisite: Set up your environment for Android development.

STEP 1 – Download Google Cardboard SDK (Google search: google cardboard sdk unity github)

  1. Go to: https://github.com/googlesamples/cardboard-unity
  2. Download the Cardboard SDK as a ZIP – see below:

Cardboard_1

Make sure to EXTRACT the zip file!

STEP 2 – LAUNCH UNITY and input the paths of your Android SDK and JDK (Java SE Development Kit) so Unity can find these kits easily.

Go to: Edit > Preferences > External Tools > Android

The input fields for SDK and JDK below:

Cardboard_2

 

STEP 3 – Import the Cardboard SDK for Unity as a custom package.

The “CardboardSDKForUnity” package is located within the “cardboard-unity-master” folder.

Cardboard_3

 

Within the cardboard-unity-master folder, select CardboardSDKForUnity package:

 

Cardboard_4

 

Important all components – don’t uncheck any boxes.

Cardboard_5

 

Next, import “CardboardDemoForUnity” as a custom package:

Cardboard_6

 

STEP 4 – Configure the BUILD SETTINGS in Unity:

Go to: File > Build Settings (CTL + SHIFT + B)

Switch platform to “Android” – Click on “Android”

Click on “Player Settings” in the Build Settings panel.

In Player Settings, go to: “Other Settings.” Input your own unique identifier under “Bundle Identifier”

Example: “game.TestProjectAndroid”

Cardboard_7

 

Under “Resolution and Presentation,” set “Default Orientation” to “Landscape Left”:

Cardboard_8

 

STEP 5 – Create a new folder in your Unity project and call it “Build.” Now, you’re ready to build!

Click on “Build” on the Build Settings panel. A panel will pop up, prompting you to save your file as an apk (Android Package Kit).

Cardboard_9

 

Input the name of your application, such as “TestProjectAndroid.”

Cardboard_10

 

STEP 6 – Copy the TestProjectAndroid.apk from your Unity project to your phone’s storage. Note: Your phone must be connected to your computer via USB cable.

Note: If you don’t see your phone on your computer, check to see if you have installed the USB Driver for Windows.

Use a file manager, such as Astro (which you can download for free from the Play Store), to locate the TestProjectAndroid.apk on your phone. See image below:

Cardboard_11

 

Click on the “TestProjectAndroid” apk on your phone. A panel will pop up, prompting you to use the “Package installer” to install the apk. Look for the green Android logo-bot!

Wait for the app to install. Once completed, your TestProjectAndroid apk will appear on the phone.

Cardboard_12

 

STEP 7 – Go back to Unity and load the Demo Scene into the scene view.

Go to: Assets > Cardboard > DemoScene

Click on “DemoScene” with the Unity icon. See image below:

Cardboard_13

 

STEP 8: Go back to Build Settings and do another build of the same TestProjectAndroid apk, but now the Cardboard DemoScene has been loaded.

Go to: File > Build Settings

Click “Build”. It will prompt you to save the apk again.

Go through the SAME INSTALLATION PROCESS:

  • Save the TestProjectAndroid apk to the “Build” folder in the Unity project
  • Copy and REPLACE the TestProjectAndroid apk to your phone’s storage
  • Reinstall the TestProjectAndroid apk on your phone (faster process since the permissions have already been set)

Click on the TestProjectAndroid icon on your phone again, but you should see the Demo Scene!

Cardboard_14

Quick Start:

  1. Download Cardboard SDK – https://github.com/googlesamples/cardboard-unity
  2. Launch Unity and input paths of Android SDK and JDK in external preferences
  3. In Unity, import Cardboard SDK for Unity as custom package
  4. Configure BUILD SETTINGS in Unity
  5. Create new folder in your Unity project, call it “Build”
  6. Copy TestProjectAndroid.apk from Unity project to phone’s storage
  7. Go back to Unity and load the Demo Scene into the scene view
  8. Go back to Build Settings (in Unity), do another build of TestProjectAndroid apk
  9. Insert phone into Cardboard and voila!