Ever tried changing the texture import settings of 5+ images in Unity iPhone? – Yes, it’s painful. Luckily someone wrote an Editor Script that can automate the task and put it up on the nice Unify Wiki. (There’s a version for regular Unity available as well here)
I just added a new menu to the Unity iPhone version of this script that lets you automate the changing of the Non Power of 2 setting as well. And while I’m at it… What’s that setting and why is it important for iPhone development?
First the basics: The iPhone can use PVRTC-compressed textures
and you might want to use this compression for 2 good reasons:
- It helps you keep your app install size down (a 512x512px image in RGB24 has about 768KB – in PVRTC 4bit it has 128KB)
- It will be harder for your app to blow up the texture memory. – If your game has a complex menu with 20 full 480×320 screens, it will most likely run out of memory and crash.
Now this is where the Non Power of 2 setting comes in. PVRTC can only be applied to textures that are square and to a power of 2 (128×128, 256×256, 512×512, 1024×1024 or 2048×2048). – Your 480×320 screens can thus not be compressed unless they are rescaled to a power of two. The non power of 2 setting gives you 4 options:
- None – Keep the original dimensions
- Scale to nearest
- Scale to larger
- Scale to smaller
Even if you choose to rescale your image you can of course still display it in it’s original size.
Yes image quality will suffer, but if I have to choose between a slightly blurry main menu and a crash, I’ll go with blurry…
It doesn’t always make sense to do this as changing a 320x20px strip from RGB24 to a 512x512px with PVRTC will most likely result in a larger filesize. I’m sure you get the general idea; same as everywhere: Thinking never hurts…
Oh, yeah, also don’t forget to turn off Mip-Maps for all your gui-images! Saves a few KB as well…
Bookmark the permalink
. Follow any comments here with the RSS feed for this post
Trackbacks are closed, but you can .