Use Particle System on UGUI to support Sorting Layer sorting rendering

Use Particle System on UGUI to support Sorting Layer sorting rendering

Particle System in Unity can be sorted and rendered according to Sorting Layer, Order in Layer and UI components (Image, Text, etc.) on UGUI

A component with a high Layer value can block a component with a low Layer value

During development, there will be such a requirement: Particle System is required to be displayed above A Image, but it must be blocked by B Image, C Text, etc. Let’s see the effect first. The display
priority
insert image description here
of the four UI components in the above picture is
Text > Image Red > Particle System Effects > Image Blue

Configure as follows
insert image description here
Canvas Render Mode select WorldSpace or Screen Space -Camera and then configure a Camera

Create three new empty nodes under Canvas, add Canvas
and name them Sorting0, Sorting1000, and Sorting2000 respectively.
Check Override Sorting in Canvas.
Set OrderInLayer of Sorting0 to 0, set
OrderInLayer of Sorting1000 to 1000, set
OrderInLayer of Sorting2000 to 2000, and create one under Sorting0
insert image description here
according to the above picture.
Image color is set to blue
Create a Particle System under Sorting1000
Create an Image under Sorting2000 and set it to red, create a Text content set to AAAAA

Then select Particle System, set Sorting Layer Id in the Renderer module
: Defalut (same as Sorting0, Sorting1000, Sorting2000)
set Order In Layer: 1000
insert image description here
and then run Unity to get the desired effect

Guess you like

Origin blog.csdn.net/LIQIANGEASTSUN/article/details/129332256