Developing for Android and iOS with Unity3D: Lessons Learned

My first masterpiece of the year is out on Android and iOS–Brick Buddies. Your very own virtual pet brick. Dare I say it’s the most accurate virtual brick simulation ever released? Actually, Brick Buddies has been out on Android Play for almost a month. After a few weeks of arguing with the App Store approval deities, Brick Buddies is available for iOS as well.

I built the iOS version first, and then spit out the Android build shortly after my submission to Apple. It took only a few days to finish the conversion, but I initially got Brick Buddies running on Android with a few commented out lines of iOS specific code and a button click. It was that easy.

What manner of sorcery did I use to make an Android port in a matter of days? Unity3D, of course. I figured I’d discuss a few loosely organized details of cross-platform mobile development here as a thinly veiled excuse to promote my app.


I developed Brick Buddies with Unity 3.5. I used a lot of plug-ins and Asset Store goodies to get it out the door with as little work for me as possible. This list includes: NGUI, Localytics (Android/iOS), MoPub (Android/iOS), Social Networking (Android/iOS), iOS StoreKit, and the Android In App Billing plug-in. I didn’t have to touch a line of native code, as the plug-ins did all the work. Although, I would like to have made some small changes to some of the plug-ins. I didn’t because I don’t want to have to merge the source in every time there’s an update from the vendor.

Platform Specific Code

Brick Buddies is a very simple app that took a few days to prepare an Android build for. More complicated apps may require a little more retooling per platform. In my case the day or two I spent porting consisted largely of swapping out the iOS specific plug-ins for Android equivalents.

One weird thing I noticed was that some of Prime31’s plug-ins have different interfaces for Android and iOS even though they do pretty much the same thing. As an ugly hack, I used preprocessor directives to disable platform specific code when calling unique methods in plug-in classes. A better solution is to write a wrapper class around the plug-ins and use different classes on each platform.

Screen Sizes

Most Android devices have 16:9 aspect ratios versus the 4:3 aspect ratio of the iPad and 3:2 aspect ratio of the iTouch/iPhone. This was something I realized when I got Brick Buddies up and running on my Nexus One and saw the HUD cut off on the sides.

Luckily, NGUI uses 3D geometry for all of its widgets. When running on Android, I simply apply a .9 scale to the X axis on the interface screens that don’t fit. Alternatively, NGUI provides features for anchoring widgets to parts of the screen when dealing with disparate resolutions.


Brick Buddies doesn’t stress the capabilities of even the most modest smart phone hardware. I mean, it’s just a brick. Still, to test for performance and weird fragmentation bugs, it’s good practice to have test coverage over the most common Android hardware types.

I’ve been building up a collection of Android devices to make sure I test apps on common chipsets. A proper collection should include the Nexus S at the low-end, a Nexus S II as the most popular mid-range, and a Galaxy Nexus as the high-end handset. I also use one Tegra 2 tablet, even though nobody seems to care about Android tablets.

For iOS, I only support devices that can run 5.X. That means 3GS and above. I had some weird rendering problems that showed up on my 4S but not my 3GS. Otherwise, I targeted the low-end with this app, so I didn’t do any other per platform tweaks.

If you’re making a real game, you will probably have to deal with some drastic performance differences between the 3GS/iPad and higher end iOS platforms. You can use Unity 3.5’s new Level-of-detail system to restrict older platforms to low-res models, as well as turn off lighting and other expensive features at run-time with a platform check.

Submitting To Apple’s App Store

It took me about 3 weeks of submission drama to get Brick Buddies on the App Store. Apple initially rejected it because it uses Game Center but they claimed it was not actually game. At first, I argued that this game had gameplay that is basically the same as Puppy World, and yet that game uses Game Center. Along with this argument, I submitted a new build with more achievements.

That was a mistake. A resubmit takes a full test cycle to evaluate. This currently stands at about 5 business days. Apple rejected it again for the original reason plus another claim that it used the GPS with no actual GPS features. This time I submitted an appeal that included my Puppy World defense and a screenshot of the GPS travel feature in action. After a few days, I was approved. When dealing with Apple rejections, appeal first and resubmit as a last resort.

All was great until Apple rejected me the same day for not submitting the achievements for approval. After submitting the achievements, it took another 3 days. This whole saga took about 3 weeks.

Submitting to Google Play

Google Play was a much simpler process. I uploaded my APK, set my description text, uploaded screenshots, and that was it. It was instantly in the store. I published an app on Android a few years back and was disgusted at the lack of metrics in the panel. Now, Google gives you all kinds of interesting stats including active installs, daily downloads, etc. You can also chop up these stats by OS, device, region, etc.


Since the Android release I’ve been messing around with advertising to buy users. AdMob and Android is a great mix because it automatically tracks conversion rates in AdMob’s control panel. I experimented with a $50 AdMob campaign at 10 cents a click and found users were costing me a little over $1.50. In line with expectations.

A big discovery issue when publishing the same app on Android and iOS making a URL that will redirect the browser to the App Store or Google Play depending on which device you are browsing on. I was going to write my own redirect code until I discovered This service generates a QR code that links to a URL that redirects your phone to different addresses based on the platform.

I can’t think of too many instances where I’d use a QR code to promote an app. So, I’m actually using it just for the URL itself. If only they spent the money on a short URL instead of


Building an app that runs on both iOS and Android with Unity3D is painless. I was shocked when I clicked a button and had my iPhone app up and running on Android within seconds. For more demanding apps you will have to deal with performance differences between chipsets and platforms as well as the dreaded Android 50 meg limit. Minor quibbles. Despite a lot of my pet peeves, you really can’t beat Unity3D for cross-platform development.

11 thoughts on “Developing for Android and iOS with Unity3D: Lessons Learned

  1. HI,RALPH,Thanks for a such a nice post. Cloud you please help on
    NGUI UI Scaling. I have the scaling problem. i dont know how to set the UI that run good on all android devices.

  2. Pingback: Native Code is Dead « Ralph Barbagallo's Self Indulgent Blog

  3. I just saw this. Thanks, Ralph. I’ve shared it. BTW, if you ever want to add touch feedback to your games/apps there is a free Unity3D plugin for Android you can use at Only works for Android though since iOS does not allow for vibration control at this time. The plugin contains 124 pre-made touch effects that you can preview through an Effect Preview App in the Google Play store that is also free. Thanks again for your Blog.

  4. Hi Ralph,
    Thanks for this great sharing! I also planned develop my game for both Android and iOS, would you please tell me which development environment you recommend? Since you need to copy xcode project from windows version of Unity for testing, so I assume Mac OS machine with Mac version Unity is better?
    Thanks in advance!

    • You can’t avoid using a Mac to develop for iOS. However, you can use Windows on Bootcamp/VMWare Fusion and the Unity.VS plug-in to use Visual Studio with your Mac Unity project. (Which is a FAR better IDE than Monodevelop on OSX)

  5. Hi Ralph,
    Thanks for this great article! I am also planning on deploy my game on both Android and iOS, which development environment you would recommend? Since I noticed that you need to copy xcode project from a windows version Unity on a mac machine for testing, so I assume Mac OS with a mac version Unity is better for development for both?
    Thanks in advance!

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s