Please consider this a strong vote for the implementation of “native” texture PNG format support.
Much like Matt, I’m fairly surprised to find that this functionality doesn’t already exist, given its importance to 2D mobile game development.
Why I think Unity should add this functionality natively:
-
Installed package size matters. Yes, the pre-distribution compression of an iOS .ipa will bring the package size down a bit – and then it explodes to uncompressed size once on the user’s device. Mobile devices do not have ‘unlimited’ storage capacity as they effectively do on PC, and users often make purchase decisions (and ‘should I keep this installed?’ decisions) based on the size of the application.
-
Deployment time matters. In my pre-Unity life as an iOS developer, I tested on device far more frequently. Deploying from Unity onto an iOS device is now an extremely slow process, and a big part of that is the fact that these perfectly lossless compressed PNGs are, unfortunately, decompressed before the lengthy processes of building an xcode project and then copying the package to the device over a USB connection.
-
Give us the capacity to choose the set of trade-offs appropriate for our own projects – am I ok with a larger package size so that I may have faster loading times? Or perhaps I would rather reduce package size and take the hit when the software decompresses a PNG into texture memory at runtime? The developer is basically always the one in the best position to make this decision for their project.
-
Asking us to work around the issue with code like the sample Matt posted creates workflow difficulties and poses problems for working with third party solutions.
We’re using 2DToolkit and Spine for our new Spider game. 2DToolkit recently added a feature called “PNG Atlases”, which, unfortunately, is a gross hack designed to work around the limitation of PNGs being treated as uncompressed textures. The way it works it that the PNGs are saved to disk with phony “.bytes” extensions so that they can be referenced as “TextAssets” and then loaded into a texture at runtime as Matt describes above.
Certainly it’s the third party software provider’s responsibility for making this stuff work properly, but at present, making this stuff work with textures in the editor is a bit of a mess. On top of that, Spine doesn’t know how to deal with a Texture that is not actually a Texture, so at present, I am incapable of using Spine in conjunction with 2D Toolkit’s PNG textures, resulting in 10s of MBs of textures in our project that are uncompressed in the final package.
More about our situation:
We’re working on Spider: Rite of the Shrouded Moon, which is a sequel to the 2009 iPhone game Spider: The Secret of Bryce Manor. Spider is a very content heavy game, especially for mobile, as every level is composed of many unique art assets. The original Spider – written in native Obj-C++ – clocked in at about 95MB total package size (after all content updates). The new Spider currently has about 1/5 of its final planned content, and recently clocked in at 781MB installed (as reported by iTunes, and the compressed .ipa was 215MB). After going through the process of working with 2DToolkit’s PNG Atlas feature (and cleaning up unnecessary references), and in spite of the limitations mentioned above, the package came down to 210MB installed / 154MB .ipa. If our content really does multiply by 5x, we’re looking at a project approaching 1GB, and this is WITH the use of properly compressed PNGs. But without the 2DToolkit work-around or a custom code solution, our project could be in the 4-5GB range, which is simply unsustainable for a mobile game. We’re quite aware of the fact that our game is going to be a big package, and that’s OK, but for us there’s simply no question that taking the massive savings in package size due to PNG compression is worth a couple of seconds of load time for every level.
If Unity is serious about supporting native 2D moving forward (as one would assume from the features added in 4.3), this feature is absolutely necessary, and will benefit devs and users throughout the Unity ecosystem.
Thanks for reading!
David Kalina
Tiger Style