Developing Unity for Android

EDIT: This article is out-dated and reflects Unity Android when it was first available in Beta. There have been vast improvements since the time of this writing.

I swear I have 10 articles in the blog saved to the “drafts folder” that I’ll end up finishing soon.  In the meantime, I’ll go ahead and post about my most recent development work: Unity on Android.

First off, this is a considerable investment and shouldn’t be taken lightly. First you have to purchase Unity 3.1 Pro: $1500. Then you have to purchase Unity Android: $1500. Then you have to pay Google to become an authorized Android Developer: $25. For those of you keeping track, I ended up spending $3025 pretty much blindly… Well, to be completely honest only the Android parts are blind… as I’m already a seasoned Unity dev on PC and Web, so I know exactly what I’m getting out of the “Pro” purchase.

I’ve been using Unity for quite some time now, and I’ve collected/written several helpful tools and what not that speed up my dev time considerably. I also love to write useful reusable physics functions (like magnets, explosions, etc) which I can then quickly put into any game I’m writing. Why am I mentioning all of this? That’s because almost all of these tools are now worthless in Android.

1. Terrain = fail.

I have a bunch of games that I think would port perfectly to Android. The first thing I did after setting up my environment (Sprint EVO 4G which took 7 hours to get working properly… but that’s for another post) was open up a Helicopter game I’ve been working on. I tried to build the game for Android and immediately I’m confronted with the error:

TerrainData’ is not supported when publishing to mobile devices.assets/new terrain.asset

A quick look in the Unity3d forums and I find that Android just can’t handle Terrain Data. My only option for creating terrain now is to build it externally and import it as a mesh… So the Terrain Toolkit I’ve been using is now worthless, which is disappointing because it’s a great tool.

2. Explosions = fail.

There’s a great tool called “Detonator” that was built for unity. It let’s you quickly and easily create awesome explosions. I had to re-write the force physics behind it because it was a bit dodgy, but out of the box it’s still a great tool. I loaded up Blast Lab and tried to build an Android version and it compiled successfully. Great! I transferred the .apk to my EVO and fired it up… only to find that the explosions absolutely kill the frame rate… I spent the next few hours dumbing down the explosions to be just a concussion wave with no glow or sparks or anything… rebuilt… same problem. As soon as I instantiate the explosion the frame rate is destroyed… back to the drawing board on explosions…

3. Controls = fail.

Unity has a really great Input manager that makes scripting controls a dream. When you’re writing your own control scripts you can just point to Input.GetAxis(“Horizontal”) and this will immediately recognize what they’re using for Left and Right. (Joystick, Keyboard arrows, A and D key, etc).  I figured that Android would function in a similar way, but alas no.  Any control scripts you’ve already written will now have to be completely re-imagined and use the Input.Touch features.  For simple things you can still do things like Input.GetMouseButtonDown(0) and it will record if they touched the screen anywhere… but that’s limited.

The worst thing about the touch controls is that there is NO WAY TO TEST THESE IN THE UNITY EDITOR! This is super frustrating. What this means is that I have to write my controls, save the project, build the project, transfer the .apk file that’s created to my EVO, install that APK via my EVO’s interface, run the game and then see if it works as expected.

So… that’s my experience with Unity Android so far. I’ve got a lot to learn, and I’m pretty invested at this point to get some games out there to try and recoup my $3025.

Advertisements

2 Responses to “Developing Unity for Android”


  1. 1 Marco Williams April 29, 2011 at 10:39 pm

    I would love to know your progress on this.. I have been learning unity for 2 months now.. and the entire purpose was to build android games.. and it seems that i missed something along the way.. because it is not as simple as they make it seem to build and export to android devices.

    This link shows some good tricks to get your terrains working fine in unity 3d .. but regardless it is a long road to get the desired results.

    I have yet to get my demo game to even build on android .. so I’m a bit frustrated as well.

  2. 2 Jan September 27, 2011 at 9:53 am

    Regarding point 3: since a while there has been Unity Android Remote which makes it somewhat easier.


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





%d bloggers like this: