2D Toolkit Forum

2D Toolkit => Support => Topic started by: TheLittleAcre on May 02, 2016, 11:44:00 am

Title: Cost of multiple collections?
Post by: TheLittleAcre on May 02, 2016, 11:44:00 am
Hi!

When setting up animations we tend to create separate collections for each one, purely for organisational purposes. So for example, Hazmat_idle pngs in one collection, Hazmat_react pngs in another. Both of these then go into the same animation. I've just been wondering about the best practice here, as I'm unsure if there's a higher cost to an animation which references many small collections rather than fewer larger collections.

Thanks!
Title: Re: Cost of multiple collections?
Post by: unikronsoftware on May 05, 2016, 09:30:53 pm
Ideally stuff everything into one sprite collection. You can name the sprites Hazmat/idle0..100 and they'll be in a folder in the sprite picker. If this is for the player sprite and/or you only have a few of them visible, you can do what you like with the atlasing without too much of an adverse effect. Basically, try to put everything into an atlas if possible. If not, try and group frequently drawn together things in the same atlas
Title: Re: Cost of multiple collections?
Post by: ComputerNerd on June 22, 2016, 10:06:27 pm
To expand on what Unikron said, I'd like to talk about why to set it up this way.

In the end it's all about graphic card round trips.  Unity does its best to combine items that use the same texture and batch them up into one call.  The reason for atlases in general is to get as many items into one texture as possible as to reduce the number of batches/draw calls done.

The 2D toolkit does a great job of packing things in tight, removing duplicates, etc. and is the way to go.