Unity3D for iOS Proof of Concept Checklist

Realtime on-device preview via Unity Remote extension

It lets you skip having to Build & Run to preview touch events functionality by connecting your device to the Unity’s Scene & Game views. Once installed, Unity Remote streams a (often low-res) version of your app to your iOS device via WIFI as you code.

A book called Unity iOS Game Development Beginner’s Guide has step by step instructions on publishing this utility app to your device.

Ran into one temporary stumbling block when trying to install Unity Remote 3 app to my device. This casting fix worked: Unity “error: assigning to ‘UITouch”.

iTween animation engine for Unity

iTween is basically TweenMax/TweenLite or Tweener for Unity. It works with C#, Javascript & Boo.

GUI: Game menus, textfields & other UI elements

As of version 3.5, the consensus in the dev community is that Unity’s built in GUI, GUITexture classes are not very efficient for mobile devices. Too many draw calls which affects performance is one of the main issues.

There are several alternatives that work better for mobile:

  • UIToolkit – free, open source; not compatible w/ iTween but has it’s own animation engine with fewer capabilities
  • NGUI – $95 & up
  • EZ GUI – $199
  • More in the Unity Assets Store. Most are not free.

Saving player settings

Looks like there’re two main options for saving player settings: Unity’s PlayerPrefs class or .NET 2.0 file i/o. The latter approach is described in Chapter 6 of Unity iOS Essentials*, while the former is known to suffer super slow performance for mobile devices.

Here’s a 3rd option: PreviewLabs’ PlayerPrefs class, an open source rewrite of PlayerPrefs for faster performance on iOS / Android.

JsonFX, a .NET JSON serializer script that has been modified to work with Unity iOS, Web, Desktop.

* The book was published in December, 2011. As of early 2012, Ch 6 contains some of type-o errors in script examples, not sure about the source files yet. The chapter uses .NET’s System.io, System.Collections & other packages with iOS’s .plist (custom xml) format and an open source project called PropertyListSerializer.
The book still uses “Application.dataPath” to grab the correct folder path to your app’s /Documents folder. As of Unity 3.3 the correct method to use is now Application.persistentDataPath.

Camera aspect ratio

In general:
iphone4 – aspect ratio is 3:2
ipad1/ipad2 – aspect ratio is 4:3

Go to File > Build Settings. Switch to iOS to see iOS related aspect ratios in for the Camera in the Game panel’s drop down menu.

Resolution & pixel density

So far not much clarity. There’s one approach similar to what I’ve seen in Objective-C & Titanium dev: check Screen.width via switch/if statement and customize values based on the result.

Code in C# or Javascript or Boo OR ALL THREE IN ONE PROJECT

Accessing a variable defined in C# from Javascript

If you want to create a Javascript that uses classes or variables from a C# script just place the C# script in the “Standard Assets”, “Pro Standard Assets” or “Plugins” folder and the Javascript outside of these folders….

In general the code inside the “Standard Assets”, “Pro Standard Assets” or “Plugins” folders, regardless of the language (C#, Javascript or Boo), will be compiled first and available to scripts in subsequent compilation steps.

Call JS from C# and vice versa – you can do one or the other but not both because if you’re mixing language scripts one of them has to be compiled first, so naturally it won’t yet have access to the other one.

C#/.NET version 2.0. Unity uses Mono (open source .NET) under the hood for C#.

Memory Profiling with iOS PRO license

With PRO license, on-device profiling is possible but works over WIFI, like Flash Builder / AIR app on-device debugging:

If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall’s outbound rules – these are the ports used by Unity for remote profiling.

Full section at bottom of page:


Remote profiling can be enabled on iOS devices by following these steps:
Connect your iOS device to your WiFi network (local/adhoc WiFi network is used by profiler to send profiling data from device to the Unity Editor).
Check “Autoconnect Profiler” checkbox in Unity’s build settings dialog.
Attach your device to your Mac via cable and hit “Build & Run” in Unity Editor.
When app launches on device open profiler window in Unity Editor (Window->Profiler)

If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall’s outbound rules – these are the ports used by Unity for remote profiling.

Note: Sometimes Unity Editor might not autoconnect to the device. In such cases profiler connection might be initiated from Profiler Window Active Profiler drop down menu by select appropriate device.

Optimizing graphics tips from Unity3D.com.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s