Building a Mobile VR App with Google VR

Module 4: Building your Application
The Build Process

Building an application is when Unity exports the project that you’ve made into a file format that can be run by a specific device. More generally speaking, building is part of the process that turns human-written code into computer-readable code.

Unity provides multiple options for building applications: you can choose a variety of platforms. Today we’re going to focus on Android and iOS to fit with our use of the Cardboard SDK. Generally, your build process will involve:

  • Switching your Unity player to your desired platform if you haven’t already

  • Adding your scenes into the build window

  • Defining player settings

  • Building to an app or a project

  • Deploying

Android Instructions

Use these instructions if you are building your VR Space application to use Cardboard on an Android phone.

  1. Download and install the Android SDK from https://developer.android.com/studio/#downloads. You do not need to download Android Studio, just the SDK tools package:

  2. You may need to install the Java development kit as part of the installation process for the Android SDK. You can download the Java JDK at the following link, or from the link in the Android installer: 

JDK Download

Select the radio button for Accept License Agreement, and then download the file associated with the Product/File Description that matches your system.

  • If you are running on a Macbook, select Mac OS X

  • If you are running a 64-bit version of Windows, choose x64 – for a 32-bit system, choose the x86 version. You can find your system information by going to Settings > System > About and looking at System Type

 

Once you have installed the Java SDK, you can continue with the Android installation. I recommend installing the SDK into a folder you will remember easily (e.g. Documents\Android or a similar location)

Build From Unity

Before we start our Android Build, we must add a few project settings.

  1. Open the Player Settings by going to Edit > Project Settings > Player. The Player Settings will open in the Inspector window.

  2. Add your scenes to the build using the Add Open Scene button

  3. Change your “Company Name”, “product name”, and “Bundle Identifier” (under Other Settings > Identification) to unique names. You’d replace these with your own information in a finalized app:

    1. Company Name: “mycompany”

    2. Product Name: “demoapp”

    3. Bundle Identifier: “com.mycompany.demoapp”

  4. Click Build.

  5. Specify a name and location to save your sample application.

When you first build from Unity, you will need to tell Unity where your Android SDK is located. Open File > Build Settings and choose Android, then click Build to start the process.

  1. When Unity asks, find the main folder for your Android SDK installation location and click OK.

  2. If prompted, allow Unity to install and update additional packages.

Once your application finishes building, you can copy and paste it over to your phone to install it. You may need to enable applications from any source (developer mode) on your phone before you can install your own application.

iOS Instructions

In order to build for iOS, you MUST have access to a Mac computer with XCode installed. You can download XCode from the Mac App Store. Unlike with Android, Unity will not produce a full runnable application for iOS, and will instead produce a project folder that needs to be compiled with XCode.

You must also create a developer account with Apple and provision this for your device. You can find instructions for this here:

https://help.apple.com/xcode/mac/current/

Google has additional instructions on their site:

https://developers.google.com/vr/develop/unity/get-started-ios

  1. Open up the Build window and choose iOS.

  2. XCode will build a project folder—enter a name for your folder and click OK to kick off the process.

  3. When the build has finished, open XCode and attach your iOS device to your computer.

  4. Click the Unity-iPhone project icon at the top of the list in XCode.

  5. Under 'Identity', choose a bundle identifier in the form above:

    1. Bundle Identifier: “com.mycompany.demoapp”

    2. On your iOS device, go to General > Profile > select the email address used and select it as a trusted device.

  6. Back in XCode, play your app to launch it on your device!

Congrats on finishing the Course!

© 2016 - 2018 ARVR Academy

  • Facebook Social Icon
  • Twitter Social Icon
  • LinkedIn Social Icon