Building Unity

Android SDK size

The Android SDK and required software can easily take up a lot of space, usually about 8GB. Please ensure you have enough space. If you wish to use virtual devices each device will take up space as well about 1-4gb each.

Building for Android

To build for Android you need the Android SDK, Java, and some other software. Luckily NVidia Android Codeworks wraps all this up in one installer. You can sign up for a NVidia Developer Account and download it Android Codeworks or download from our OneDrive folder OneDrive Link.

Once downloaded this can be installed with the default settings. If you want to save some space make sure you have the Android SDK defaults, and Android Toolchain defaults. Developer tools and drivers, etc. aren't needed this can save up to 2GB. Make sure to take note of where it was installed, as this will be needed later.

After everything is installed restart your computer then load up the project in unity. Go to file -> Build Settings, make sure the Android platform is selected. Click build and run to deploy to a connected Android phone. Unity will ask where to save the APK file (installer file), please pick somewhere outside of the project folders for example your downloads folder.

If you haven't already the phone will need to be setup for developer settings. This varies from device to device but a quick google search "unlock developer settings on android phone name" will give you step by step instructions. Once unlocked go to your developer settings and enable USB debugging, you will also need to allow installing APK's from unknown sources, this is usually found in security settings but can vary from phone to phone.

The first time you try to build for Android Unity may ask for the Android SDK location, this is not to be confused with the Android Codeworks location, the folder is within the Android Codeworks folder titled android-sdk-windows. Unity may also ask for the JDK (Java Development Kit) this is in the Android Codeworks folder as well under JDK1.8.0_77 please select these folders for it to successfully build.

Building to Android Virtual Device

This section will cover one of the easier ways of creating and deploying to Android Virtual Devices (AVD), this is generally a tricky process but once setup up easy to use. By using virtual devices this allows us to test on multiple screen sizes and hardware during development, without having to pay out a fortune on devices.

Install Android Studio this will be used for its nice user interface for virtual devices, and will handle a lot of the hassle of downloading updating and managing virtual devices. During installation, you do not need to download/install the Android SDK again you can just direct it to the Android Codeworks SDK folder.

Uncheck the Android SDK, as you should already have this installed. This will give you access to the following screen. Where you direct it to the Android Codeworks SDK folder.

Let this install it can take a while start it up and update anything that it requires please. Once updated make an empty project, pick default settings it doesn't matter we just want to use the AVD manager in Android Studio.

Once it is setup go to tools-> Android->AVD Manager and start it. This brings up the AVD Manager in here we can; create, download and start Virtual Devices. Let’s go over setting up a device and starting it. Click Create Device this will bring up a screen allowing you to pick a virtual version of a real device.

Pick the Nexus 6. The next screen allows you to pick the OS version that is running on it. Download Nougat, with API Level 24, x86_64, with the google API's. once downloaded highlight it and press next.

On the next screen leave the default settings and press finish. Once finished you will have a virtual device you can run by clicking the little green play symbol beside it. It will take a while to start up, you can ignore most of the start-up stuff. there are some cool settings you can play with; phone rotation, volume, screenshots, internet, fake camera. If you click the 3 dots at the bottom of the tools bar; this will give you access to even more controls.

In Unity, you can just use build & run when set to Android platform and it will run it on the virtual device, or you can drag and drop the created APK file.

Building for iOS

iOS development requires the use of a Mac. The Mac must have Unity with the iOS plugin installed. You can easily add this plugin with Unity by going to build settings and selecting iOS it will show you a download link to follow to install it, or already be installed. The Mac should also have Xcode installed.

Once everything installed open up the Unity Project and go to Build Settings and change it to iOS. Once it has reimported and rebuilt the assets. Build the game for iOS, once finished it will open up Xcode and continue setting up and Xcode Project. The Xcode project will allow you to launch it on a connected iOS device fairly easily, sometimes Xcode will ask to change some settings this is usually fine but use caution. There is plenty of FAQ's and tutorials of this proccess online if you run into problems.

Cloud Build

With your Unity account, you have access to Unity Cloud Build. This allows Unity to build our Unity Projects in the cloud and gives access to these builds to be downloaded and run on laptops, phones, mac's, pc's and Uni computers. This is handy for everyone having a build; a stable build from the master branch to show people, or the develop branch for testing.

To access this feature, you needed to be added to Team19 on Unity using your Unity email, give this to @StewMcc if you haven’t already, and you can see all available builds on Unity Cloud Build.

To access the build on iOS there is some extra steps required by Apple. The device you wish to run the app on is required to be added to a mobile provision file and a p12 file used by Unity Cloud Build. These files hold a list of devices the app can be installed on. To be added to this list you need to find out your UDID. Apple UDID tutorial. This then needs to be added to to the developer account, contact @StewMcc to add the device. Once the device is added a new p12 and Mobile Provision file need to be created and added to Unity Cloud Build, after this Unity will build a new version of the app that can be installed on the new device. Pester @StewMcc to get this done, but please be aware it takes time.

Load times

Please be patient the Unity Cloud Build website can take a while to load at times.
Sadly it doesn’t show this very clearly but don’t reload the site if it says Loading.