- Home /
unity shader : Applying ZOrder to sprite renderer conditionally
here's scene object info of above figure. all of object's renderer is 'SpriteRenderer', and Material is 'Sprites-Default'.
[A (Car)] OrderInLayer : 302 Local Z Position : -9.8
[B (Land)] OrderInLayer : 270 Local Z Position : -9
[C1, C2 (Land)] OrderInLayer : 300 Local Z Position : -10
[D (Land)] OrderInLayer : 330 Local Z Position : -11
I hope that you do not obstruct the 'D' is 'A' in the above situation.
But such a situation can not use OrderInLayer.
So I'm not sure at all that you will use the same shader.
Help!
Answer by tanoshimi · Jun 08, 2016 at 06:14 AM
D is appearing on top of the car because it has a higher order in the sorting layer.
Note that if you're creating a 2D game with an orthographic camera, don't use Z to sort your objects. Place them all on a single plane (Z=0, for convenience) and then use sorting layers and order in layer to sort them.
Your answer
Follow this Question
Related Questions
How to force the compilation of a shader in Unity? 5 Answers
Sprite ZFighting in 2.5D game 1 Answer
Gaussian Blur Shader 2 Answers
Receiving Shadows On a Tranparent Shader 1 Answer
How can I create glowing trail effect? 0 Answers