Hello Guest

Author Topic: Cost of multiple collections?  (Read 3736 times)

TheLittleAcre

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Cost of multiple collections?
« 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!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Cost of multiple collections?
« Reply #1 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

ComputerNerd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Cost of multiple collections?
« Reply #2 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.