SET UP iOS DEVELOPMENT & BUILD CARDBOARD DEMO

Part A: Set Up Unity  |  Part B: Deploy in Xcode  |  Part C: Update the Scene


For setting up the iOS environment, we’re including the build of the Cardboard Demo. If you have any problems with this set-up, go to: Google Developers page: “Getting Started with Unity for iOS” >> https://developers.google.com/cardboard/unity/get-started-ios

PART A: SETTING UP UNITY FOR IOS / CARDBOARD

STEP 1: Download and install Unity 5.2 or higher.

STEP 2: Download and install Xcode from the App Store:

IOS_Cardboard_1

Xcode is a free but large application, so expect a long download.

STEP 3: Download the Cardboard Demo SDK as a zip file and extract – https://github.com/googlesamples/cardboard-unity

Cardboard_1

STEP 4: Launch Unity and import the Cardboard SDK for Unity as a custom package.

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

IOS_Cardboard_2

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

Import all components – don’t uncheck any boxes.

Cardboard_5

 

STEP 5: Import “CardboardDemoForUnity” as a custom package.

Cardboard_6

STEP 6: In Unity, load the Demo Scene by clicking on it in your assets folder.

Go to: Assets > Cardboard > DemoScene

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

STEP 7: Configure the BUILD SETTINGS in Unity.

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

Switch platform to “iOS” in the Platform menu – you must click on “Switch Platform.”

IOS_Cardboard_5

Click on “Player Settings” >

  • Go to the Inspector on the right hand side of Unity.
  • In “Other Settings”, input a unique identified under “Bundle Identifier”
  • Example: “game.TestProjectAndroid”
  • In “Configuration” under “Other Settings”:
    • Set “Scripting backend” to “Mono2x”
    • Set “Target minimum iOS Version to “8.0”
  • In “Resolution and Presentation,” set “Default Orientation” to “Landscape Left”:

SEE IMAGE FOR PLAYER SETTINGS FOR iOS BUILD IN UNITY:

PlayerSettings_IOS

 

STEP 8: Click “BUILD” after you’ve modified the Player Settings.

PART B: DEPLOYING YOUR UNITY/CARDBOARD PROJECT IN XCODE

From: Google Developers page: “Getting Started with Unity for iOS” >> https://developers.google.com/cardboard/unity/get-started-ios

STEP 1: Open XCode. From the File > Open… menu, open the XCode project that you created. It will be a file called Unity-iPhone.xcodeproj inside the directory you just saved under in the last section.

IOS_Cardboard_7

STEP 2: Select the Unity-iPhone project by clicking on it.
STEP 3: In Xcode, go to Build Settings and search for Bitcode. Switch this to OFF (disable it), screenshot below:
DisableBitcodeXcode
STEP 4: In the project menu bar, click on Build Phases to open that section.
STEP 5: Expand the Link Binary With Libraries list.
STEP 6: At the very bottom of the Link Binary With Libraries list, click the + sign. This opens a window that says “Choose frameworks and libraries to add:”.
STEP 7: Add Security.framework.
STEP 8: Go to File > Add File to Unity-iPhone…. Select the CardboardSDK.bundle file in [your Unity project]/Assets/Plugins/iOS. Click Add.
STEP 9: Now run the project, either by clicking the PLAY BUTTON, or by going to Product > Run.

If all went well, you should see a “Build Succeeded” and the Cardboard demo launches on your iPhone!


PART C: UPDATE THE SCENE

QUESTION: What is the flow to update the scene? Make updates in Unity, build, then just build again in Xcode?

ANSWER:

  • Make updates in Unity.
  • Go to Build (NOT Build and Run).
  • You’ll be prompted to replace or append to the Xcode project.
  • Choose Append.
  • Then build from Xcode. The settings will be retained as long as you append and don’t replace.

 

Quick Start – iOS

PART A: Setting up Unity for iOS/Cardboard

  1. Download and install Unity 5.2 or higher – https://unity3d.com/get-unity/download?ref=personal
  2. Download and install Xcode from the App Store
  3. Download the Cardboard Demo SDK as a zip file and extract – https://github.com/googlesamples/cardboard-unity
  4. Launch Unity and import the Cardboard SDK for Unity as a custom package.
  5. Import “CardboardDemoForUnity” as a custom package.
  6. In Unity, load the Demo Scene by clicking on it in your assets folder.
  7. Configure the BUILD SETTINGS/PLAYER SETTINGS in Unity.
  8. CLICK BUILD.

Part B: Deploying Cardboard demo in Xcode

Go through the instructions on left carefully!