Sprite size 2d game

Hi! I am currently trying to figure out how to properly import sprites for a simple 2d game and struggling. From my understanding it is best for both gpu optimization as well as compression algorithms if both sprites and sprite sheets are made based on powers of two. It is also my understanding that it is best that all sprites abide by the same pixels per unit.

Looking at my game, my camera has an orthographic size of 10, my target resolution is 1920x1080, and using simple unity square sprites (256x256 at 256pixels per unit) on the 1920x1080 screen I have a sense of the sizes I like for my sprites:

*all sprites below at 256 pixels per unit
256x256 for sprite 1
1024x256 for sprite 2
1024x1024 for sprite 3
1024x512 for sprite 4

From what i gathered, it is wise to draw my sprites at double the size I would like them on screen. This means I would then ask an artist to draw my sprites at:

512x512 for sprite 1
2048x512 for sprite 2
2048x2048 for sprite 3
2048x1024 for sprite 4

What I don’t understand:
1 - Based on these sizes how can I make sprite sheets? Some of the sprites have animations so it seems like the sheets would be extremely large based on these dimensions and since I would like to also deploy my game to mobile I understand it is recommended to not make sprite sheets larger than 2048x2048
2 - My game has one static background. Does a background sprite also need to conform to a power of 2 rule or am I supposed to make a background sprite in the same dimensions as my target resolution to fill the screen? I ask because when uploading a 1920x1080 sprite to test unity shows me an error saying only power of two textures can be compressed.

You’ll do fine to start with by just using the default pixels to world unit and then adjusting your camera ortho size. Get some progress, work with some real problems implementing your game, get it up and running at SOME fundamental “first full game loop” level before you go agonizing about pixels and dimensions excessively.

While this may be true, it may also be irrelevant.

Nothing needs to be optimized if you never ship your game because you’re focused on optimizing it.

DO NOT OPTIMIZE CODE JUST BECAUSE… If you don’t have a problem, DO NOT OPTIMIZE!

If you DO have a problem, always start by using the profiler:

Window → Analysis → Profiler

Failure to use the profiler means you’re just guessing, making a mess of your code for no good reason.

https://discussions.unity.com/t/841163/2

Notes on optimizing UnityEngine.UI setups:

https://discussions.unity.com/t/846847/2

1 Like

this is needed only if you intend to zoom in on the sprites, the part “double the size I would like them on screen” implies that further along development you MIGHT want to zoom in on the sprites and you would regret then that you did not make them at double size.

In any case you are juggling very large sizes which as you say make sprite sheets kind of pointless, its not like you need to make a sheet anyway.

also if you want to deploy on mobile you should make the game 1280x720 at least for the mobile build, will cut a lot of size on your final build and most phones dont even have 1920x1080 res, even if they do it is hard to notice the difference on phones due to small screen

1 Like

Thanks for your reply! the game and functionality are all entirely built already and all that is left is to import the final art. While profiling the only optimization setbacks are gpu related such as draw batch calls which are due to incorrect sprite import settings for the gameobjects in the play scene (UI sprites are already all in sprite atlases and working great).

When you said to use default pixels to world unit and then adjusting your camera ortho size are you referring to the default of 100 pixels per unit? Meaning if I have a camera ortho of 10 and I want a sprite to take up lets say 10% of the screen I would need it to be 2 units tall therefore 200x200pixels at 100ppu?

Thanks for the reply! I am looking to deploy specifically to android and struggled a lot in terms of picking a reference resolution. All of my ui and code is dynamic based on screen size so I can easily change to any resolution I choose. Is 1280x720 a good resolution for android specifically? And also did you have any insight as to what my reference resolution means for my background sprite’s size if I want my the background to simply fill the screen (should I have it exported at my reference resolution?)

yes if your background doesnt scroll it should be exactly the size of your resolution

so if your res is 1280x720 that should be the exact size of your bg sprite

1280x720 is good for android, 99% of the phones will have that res ( if they have 1920x1080 they prob wont notice the difference, but will notice the bigger file size when they have to download the game)