2D Frame based animation on mobile

We’re thinking about switching platforms from Flash/AIR to Unity for our 2D mobile and desktop games, but I have a few questions hopefully someone can answer. They’re being ported from a desktop platform SDK and changing the artwork at this point is not really an option.

We have 2D games that uses a significant amount of cartoon frame animation. We are currently test developing based on Flash/AIR/Starling but have ran into slow loading issues on some android devices. One of our games contains 10 2048x2048 packed sprite sheets. Based on texture compression they fit into 12.3 MB.

Each of our games has animated characters (around 160x180), plus a number of 180x180 animated squares, each with about 30-50 frames of animation.

The question is, does Unity support loading these animations on the fly from disk or memory rather than having them always in the GPU? It seems like we would have better luck supporting more devices if we didn’t need to have all these sprite sheets loaded constantly in the GPU. Is Unity good for this kind of thing?

Thanks

Unity allows you to dynamically load texture resources, but all this is going to buy you is an improved scene loading time assuming you only load a subset of the aforementioned textures for any given scene… However, if you use all textures in each game, you gain performance by loading all of your textures into the GPU at once, not by changing them out, so maybe I’m not fully understanding your question.

Obviously, if you are unable to load the textures due to lack of available memory, the underlying engine and drivers will be responsible for swapping them in and out each frame which will cause a performance hit. Optimally, you want to have all textures used in the scene in video memory at all times if you can.

Unity is in the business of generating games, and it does it well, so yes you could potentially see an improvement over your current implementation, but having created a game for Android with a wide range of devices supported, using a different engine, I can tell you that sometimes the engine can’t help you at all. You just won’t be able to satisfy every device. I would change a certain component from drawing transparently to opaque but using a mesh to improve (read make playable at all) for one device, and then performance sufferered on another device. Then out of the blue, the game just stopped working on newer devices, had to remove GLES 1.1 and move to ES 2.0 because those new devices were poorly backward compatibly tested, so then I had to exclude 1.1 devices from receiving the latest updates. And on and on it goes with Android.

As for using texture atlases, I believe that is built into the v 4.3 of Unity natively, but I’m not sure it is mature enough yet. If you want to be safe, the 2d toolkit is an awesome plugin you can get from the asset store. The toolkit has some great features to quickly load textures if they are saved as unique incrementally named files and generate the atlases for you.