I’ve done a small game which i’ve tested successfully in android devices. But when i’m trying to switch platform between android to iOS, all the images are getting stretched. please check the below image in android platform, its now 512x128 RGBA 16bit.
Like this all the images are getting stretched. But i can able to build the project to xcode as well as iOS devices also. When i’m running in iOS device, some of the images are missing, displaying in wrong position with different height and width.
What exactly is the problem? should i’ve to do something before switching to iOS? Please help me out.
That is because of the Non Power of 2 setting in the texture import settings. When on (which it is for normal Textures) it will upscale or downscale the image to the nearest Power of Two size ( 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 etc). This is because Power of Two textures require less memory and less gpu power to load and use, so it is generally a good thing. On android this size does not need to be uniform (one edge can be 510 while the other can be 1024), but on iOS to get the benefit of Power of 2 textures it needs to be square, so the TextureImport Upscales/Downscales the texture to a square size.
You can turn off the Power of 2 requirement by clicking on the texture and in the inspector change the Texture Type to Advanced and then change the Non Power of 2 option to None and Apply the settings. But keep in mind that this is a change for all platform so it will still be off when changing back to android, and also only Power of 2 textures can use the best compression formats.