Why particle effect alway rendered after UI though they have same sorting layer and same sorting order?
I searched a lot of information about it,every one said that both of effect and UI are controlled by sorting order and sorting layer.If UI's sorting layer is same to effects' and sorting order is bigger then effects', then UI will render after effect and the result is that UI cover effect.
But what they will do if they have the same sorting layer and the same sorting order?I found that effect alway cover UI in this case.I think this is because effect render after UI. But why?
There are some pictures below:
Hope anyone could answer me.Thanks.
Answer
After your question I was curious about why particles system always render in front of the UI when both UI and Particles system are having same sorting layer and sorting order.
So I find out some thing interesting:
Project Hierarchy: same project hierarchy is used for both situations.
Situation # 1: Canvas (Render Mode : Screen space overlay):
screen shot:
So from frame debugger its clear that if Canvas render mode is Screen space overlay the all of the scene objects are rendered before canvas.
Situation # 2: Canvas (Render Mode : Screen space Camera):
So frame debugger making things clear that canvas is rendered prier then particles if Canvas render mode is Screen space camera.
Summery: As for both of the Canvas and Particles sorting layer was "Default" and sorting Order was "0".
But in screen space camera particles was rendered after canvas so we see prticels in front of the UI.
while in case of the screen space overlay UI was rendered after Particles , so we saw canvas in front of the Particles.
Which means Unity do change rendering order for in different situation. I hope this will clear your confusion.
No comments:
Post a Comment