Hello Guest

Author Topic: Sliced sprites, or non uniform sheet and Z order.  (Read 3834 times)

necdel

  • Newbie
  • *
  • Posts: 2
    • View Profile
Sliced sprites, or non uniform sheet and Z order.
« on: August 20, 2016, 05:57:29 am »
Hi guys, I did some searching and the only reference I found was an old post relating to Unity sliced sprites.  So I just purchased yesterday and want to double check if the case is still that 2D Toolkit does not support non uniform sprite sheets ? 

I have a lot of sheets that include a myriad of sprites in no determined tile size from my artist.  Unity handles these fine but I have been unable to determine how to use either the split texture or allow 2D Toolkit to do the same.  It is not a big deal, just curious if I am missing something in the framework.  It will be just a little hiccup in the pre existing workflow.

My final question is on the documentation for 2D Toolkit, I find the blurb about Z order and collections a bit confusing.  It states in the tutorials :

Quote
Note: Although our game is quite simple and small, if you are doing bigger and more complicated games it is more important to think about which sprites you want to group together in a collection. Unity has a built in dynamic batching system that is automatically used to reduce draw calls, and the most efficient way to organize the sprites are by Z value. Overlapping sprites from different collections increase draw calls. Keep sprites from the same sprite collections grouped together.

Does this  mean,

1. It is more efficient to organize by Z order, so these sprites are background and these are collidable.

or

2. These sprites are Z ordered in front of one another in the scene so should be on the same collection.

The line that confuses me is this

Quote
Overlapping sprites from different collections increase draw calls

You state in the previous sentence that ordering by Z order is most efficient, which would be case 1.  But then this sentence leads me to believe if sprites are overlapping one another, so in my mind, multilple Z order sprites, should be on the same sheet so that the rock is on the same sheet as the tree that is drawn above it on the Z order.   So this makes me think of case # 2, where I would simply try to keep all of my sprites for a particular scene on the same sheet and not specifically the Z order.

Thank you for your time, and thank you for your effort in this package.. making unity usable in some real fashion with 2D for now.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sliced sprites, or non uniform sheet and Z order.
« Reply #1 on: August 20, 2016, 11:58:24 am »
In 2d toolkit, sprites are organised in sprite collections.
Basically you don't want to end up sorting sprites from different collections together - thats inefficient. On the other hand if they're all in the same collection you can sort any which way you like and you're good.

Make sense?

So for a background, you can leave the background objects in a collection and the foreground in one - that will effectively batch into 2 draw calls. Draw calls are not as bad as they used to be (when we first made tk2d, 20 draw calls was a lot...)

necdel

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Sliced sprites, or non uniform sheet and Z order.
« Reply #2 on: August 20, 2016, 10:24:11 pm »
Understood now, thank you!