When I ran my first Android build of Hyperspace Pinball (coming from iOS), the performance was terrible. Here's a list of things I did to make it work better before releasing it to the Android market:
- Minimized the number of calls to OnGUI - Before my changes, I had at least five different HUD-related objects all doing their own OnGUI's. This hurts performance. I did some house cleaning and refactoring so that there was only one call to OnGUI at a time, and only because it was absolutely necessary.
- Replaced all TextMesh objects on static backgrounds with new static backgrounds that has the text pre-rendered on them. TextMeshes create transparent rendering overhead, and my HTC Thunderbolt doesn't handle lots of transparency calls very much. Most of my optimizations were centered around minimizing those calls.
- Reducing particle sizes. As it turns out, I was overusing a lot of particle systems. Reducing particle counts in my emitters from say, 100 particles to 50, hardly looked any different. It also improved performance.
- Cached transforms and rigidbodys. I think this made a negligible difference, but I saw a lot of get_Transform and get_Rigidbody's in my profiler. So, what did I was declare member transforms and rigidbodies to the offending objects, assigned them in Awake(), and used them everywhere I would otherwise use transform and rigidbody.
- Used deep profiling to pin down poorly performing scripts. I know "Buy Unity Full" isn't the answer you want to hear, but you should seriously consider going to Kickstart and raising funds to get it. It's worth it.
- Make a preference for how big the particles are. Despite everything else, I still had slightly choppy behavior on my Thunderbolt in multi-ball. So, I have a preference slider in the configuration menu that goes between 0 and 100% that defaults at 50%. 100% means max particle sizes. 0% means small particles. Less than 25% will render solid instead of transparent lines in the alien meshes (using Vectrosity). Less than 10% will render the alien meshes as regular meshes with a special texture (basically turning off Vectrosity). There's also a low quality button which makes -everything- rendered in the lowest possible playable quality; the backgrounds become textures.
In the end, I got Hyperspace Pinball on the Android Market. If you're a Unity developer and you're reading this, don't forget to support the Home/Menu/Back buttons in your Android apps!