- Home /
Order in layer works if it's -1 and 1 but not if it's 0 and 1
Why? I don't see the logic in this. I have two game objects with sprite renders. If I try to use 0 and 1 on the order in layer it won't order at all, but if I use -1 and 1 it does lol. This doesn't make any sense, whatever I got it working but I'd like to know what's going on.
Answer by prashantagarwal1996 · Dec 06, 2018 at 04:53 AM
Possible Solution
It is not suppose to happen, I've checked in mine works fine for me. I am using version 2018.2.18f.
Try moving the sprites in hierarchy to check, or put all of them to 0 and then try assigning the order again.
About Layers and Sorting:
Unity allows control over rendering sprites in two ways:
By Layers: You can create new sorting layer and assign them to Sprite,
By Order: Further you can create order in a layer to assign what renders on top.
.
For Example:
You can assign a Player a character layer to differentiate it from say Background. Furthermore, you can order individual character sprite in different order like:
Body=1, Cloths=2.
Now to answer the question: (This is from my understanding)
When you assign object with a layer the whole object draws on order 0.
Now to assign order within a layer you have to assign it with a negative number to move it back and positive to move it in front. If you keep it at zero unity does not understand if you want to move it in the back or in the front.
Your answer
Follow this Question
Related Questions
Show GUI above Gizmos 0 Answers
Ring Particle around Sphere Particle 0 Answers
Does rapid layer changing affect performance? 1 Answer
How to layer GUI textures so certain textures are in front of others 1 Answer
Layering paint? 1 Answer