2D Toolkit Forum

2D Toolkit => Support => Topic started by: Trigve on December 10, 2014, 10:14:08 am

Title: Order in layer vs. Z-ordering priority
Post by: Trigve on December 10, 2014, 10:14:08 am
I was just playing with the "order in layer" and z position of the sprites and want to be sure (because found out in some previous version of unity it was working differently).

The priority has the "order in layer". That is, the sprite with higher order than some other sprite is drawn at the "top", the Z-position isn't taken into account. Only if the "order in layer" are the same, the Z-position is taken into account and could fine tune the draw order.

Am I getting this right?

One more question, what is the maximum value of the "order in layer"? Is it somehow dependent on the (Z buffer)/(near-far plane position)? I found that max positive value is (2^15) - 1.

Thanks

Title: Re: Order in layer vs. Z-ordering priority
Post by: unikronsoftware on December 12, 2014, 03:24:01 pm
Order in layer takes precedence over z.
You've got it right, order in layer trumps the z position.

I don't know about min and max values for it though, its a unity feature and the unity docs make no mention of limits.
Renderer.sortingOrder
I'm pretty certain it has nothing to do with zbuffer values or near clip values, its just something to manually order object draw calls.