I'm starting a 2D game in Unity iPhone and trying to understand a bit more about the graphics required to support universal apps (iPad/iPhone) at the same time. Currently for a background image i'm using a 1024 x 768 image (native iPad resolution) and when it renders on the iPhone i have "black bars" on the left and right side (landscape). I understand the resolutions are different on the iPad (1024 x 768 @132ppi) and iPhone (480 x 320 @163ppi). What is the best way to create your sprites/textures to support both platforms? Do i need assets for both? Is there Unity project settings that help? Being a first time game developer/Unity user this has me a bit confused. General explanations of how the "guts" work are also welcome.
asked May 18 '10 at 02:19 PM
As a Technical Artist currently porting an iPhone game to iPad, I will tell you that it is necessary to have separate textures per resolution.
Keep in mind that Unity will not compile the unused assets so you do not have to worry about a bloated executable.
The best advice I can give you with Unity iPhone in the state that it is now is to concentrate your initial production on deliverable for the iPhone and then port to iPad following.
You should, however, keep in mind when programming anything dealing with the touch interface and screen space to expose the necessary properties [variables] so that you may easily change UI sizes during upscaling. If you build your UI with this in mind from the start it is going to make porting to iPad much, much easier.
You should also know that you will not have the clean workflow of building for iPhone when up-scaling for iPad because there is currently no Unity Remote that supports iPad's 1024x768 resolution. That means all of your touch interface Rects and debugging should be done when building for iPhone and set up fluidly so all you will need to do is change Rectangle dimensions and positions when converting to iPad. I really can't stress this enough because it is the source of all of my frustration during this port.
Sorry, I am drifting off topic...
On iPhone/iPad you should not have a texture be any larger than it needs to be. You will quickly notice that your graphics memory is the farthest thing from infinite. I will suggest that you read up on how Zombieville USA was built and all of the creator's forum threads concerning it as it is a wealth of information on how you can squeeze the best looking 2D iPhone game out with Unity.
A couple Rules of Thumb when building a 2D game for iPhone in Unity:
1) You probably shouldn't be using PVRTC compression on your textures as you will notice that your image quality will be awful.
FYI - PVRTC is good for "real world" textures and 3D graphics because of the skewing and stretching, perspective and mipmapping effects are less noticeable. With 2D (most commonly vector) you want crisp detail and optimum fidelity. For this I suggest that image compression is set to Uncompressed RGB(A) 16 or 24 (depending on the necessity of an Alpha channel)
2) Disable mip-mapping as it greatly increases your memory consumption. You also are going to be using an Orthographic 2D view so there will be no need for mipmapping anyway.
FYI - Mipmapping is LOD simulation that generates a cascading set of textures that decrease in size. Unity then applies the lower resolution textures by calculating how far the object is from the camera and how detailed it should be. This saves on processing power because you won't be taking a hi-res texture and drawing it on a surface that might only have a value of a few texels (pixels in a vector texture unit). This of course affects your memory consumption as these additional textures need to be cached.
3) If you are using 3D planes to draw your 2D sprites, use the iPhone specific shaders. They are optimized for the iPhone's GPU. Also, transparency/translucency should try to be avoided wherever possible.
Sorry for the long drawn out response but I figured that I'd consolidate some knowledge here instead of pointing you around to the various threads where bits and pieces get mentioned.