I’ve been wondering this question for ages, but have never been able to track down an answer online.
In my game I have a lot of sprites. Originally I added them to a single sprite atlas. Over time I had a lot of sprites that were for just a particular scene which isn’t loaded very often, so I put them in their own sprite atlas, but eventually I started having duplicates between the two atlases. I then started splitting out all the UI images into their own atlases too, which started to get messier with duplicates between them all. Eventually I started splitting out atlases on a per-scene level to make sense of them, so that only the sprites required to build that scene were included, but it seems that it only took one accidental sprite to be missing which was available in another sprite atlas for the second sprite atlas to get loaded into the scene anyway.
My original goal was to try to speed up load times by only loading into memory the sprites/textures I needed, but it seemed with all the duplicates amassing over time this was having the opposite effect. Today I just made one master sprite atlas and dragged my entire sprite folder into it, and my load times improved by a huge amount. The main drawback I’m worried about is that if I’m loading up all my sprites into memory, is that going to blow up the system specs of the game? I was originally trying to make sure only the assets used in the scene are being loaded, but for all I know perhaps Unity just loads up all the atlases in the project into memory anyway.
Before I check my code in and make a fairly substantial change to my project, what is the best practice on sprite atlases?
Pretty sure the answer is just the usual tradeoff between fiddly effort and diminishing returns, and where you choose to draw that line.
Mostly I group small sets of related sprites together and set their packing tag to have Unity pack it for me automatically.
I try to keep these collections relatively small, but still meaningful, such as in my Jetpack Kurt game, all of the sprites used for the main diagetic cockpit dials and gauges are tagged with the same packing name, so they tend to get stuck into one sheet, but nothing else goes in there.
By packing it I (can) get the benefit of single draw calls for the entire dash, and by keeping the packing relatively “localized” I don’t load the entire game’s sprites in just to show the altimeter, for instance.
build your game and open the task manager of windows, if you thing the game is taking up too much ram then you should divide the atlas until you are happy with the results. For example if you see 4gb of ram used and you want only 500mb then you should divide the atlas into 8