Best Image Formats, Sizes, and Resolutions for Unity Sprites?


I’ve been wondering what is the best image format, size, and resolution to use with unity for a 2D game. I’ve been building my 2D game for a while now, unfortunately though, the game reached a size of 150MB (for Android) and its not currently running on old phones with low processing or memory.

Since it is a 2D game, I figured that reducing the size of the game is the best thing to do whether it is the cause of the problem or not.

Currently, I design all my sprites with 1000x1000 pixels, and with 150 pixels per centimeter.

A sub-question: Why does a 60KB png image with alpha (with the above size and resolution) becomes a around 5MB in Unity?

Thanks in advance.

Well, the way you do it, you end up with unnecessarily big textures.

Overlap would be applicable, if you actually needed the textures to be 1000x1000, but you don’t. But if you did… this is what would happen: assuming a target HD screen with resolution 1920 x 1080, you have 1920 pixels in width. So, if each texture is 1000 pixels wide, with 2 sprites arranged side by side you’d have 2000 pixels to fit into the 1920 pixels of the screen width, so the minimum overlap would be 80 pixels. Now, if you have more than 2 sprites, or your 2 sprites are not placed as far apart as possible, the “excess” pixels (overlap) would be much greater than the 80 pixels.

Anyway, I just mentioned overlap to emphasize a point.

The thing is, that you should have at least one target screen resolution. Personally, I have two, a. 1920x1080 for high end devices, and b. half of that 960x540 for low end devices. Then, I provide each texture for the sprites, at a size suitable for each screen resolution ‘a’ and ‘b’. At start up of the game, I detect if the device is high or low end, and load the sprites suitable for the particular screen resolution. Of course, in a simpler setup, you can provide textures for the higher resolution only, and scale down for any lower resolution.

I think it’s best to use an example to demonstrate (using the above 2 target resolutions). This is the workflow I have found works well for me:

Say I want to work out how large a texture I need for my “Player” sprite. First of all, I want to find out the percentage of the screen width and height that my Player occupies. So, I set the Game view to display at Landscape 1920x1080, as my game. Then, I just take a ruler and measure the game screen width and height, and the Player’s width and height. Of course, to do that, I use an existing spite for the player, at a suitable scale, or another sprite in the scene that would help me determine the size of the Player sprite by comparison.

So, lets say: game screen width and height: 30.7 cm x 17.3 cm (approximately). Player’s width and height: 2.5 cm x 3.2 cm (approximately).

This gives the Player to be: width 2.5 / 30.7 = 0.081 of the screen width, which is 1920 pixels, i.e Player width in pixels is: 0.081 x 1920 = 156 pixels.

Similarly, the Player to be: height 3.2 / 17.3 = 0.185 of the screen width, which is 1080 pixels, i.e Player height in pixels is: 0.185 x 1080 = 200 pixels.

So, the texture size I need for my Player sprites is 156x200 pixels, to display in the best quality possible at the target screen resolution of 1920x1080 pixels.

if I supply a texture of 1000x1000 pixels for the same sprite, it would be 1000/156 = 6.4 times larger than necessary in width, and 1000/200 = 5 times larger than necessary in height. So, the texture size would be over 30 times larger than what’s needed with no gain at all in quality at the target screen resolution.

Of course, it’s a very crude method to get the ruler out and measure the screen, but it has worked fine for me so far. If someone can suggest a better, “more elegant” method, please let me know. I’d be happy to try it out.

Regarding “Power of Two” for best compression. Well, I just don’t use compression, because whenever I did, I noticed significant degradation of quality. This is an old thing, and maybe things have improved, but everything works fine for me with no compression.

Regarding your sub-question. It’s kind of a mystery to my how Unity texture importer handles images. I’ve been surprised over and over for many years, and I still haven’t found “the formula” used. I believe that what’s happening is that a 60KB png has compression applied, but I suspect that there’s enough information in the png so that Unity importer can decompress it to 5MB, so that later it can compress it according to your custom settings. Anyway, this is just speculation. If someone knows exactly what’s happening, I’d be grateful to know too.

first, resize all your sprites to power of two (POT) [like 1024x1024 - 1024x512 - 2048x2048], this allows unity to compress your sprites very efficiently,
also chec alpha to none if you dont use alpha channel (this is important) here :

also, you can increase compression too.