I’m trying to make a particle system that will show on top of UI elements. This seems to be an impossible dream at this point. Which is odd because I had it working at one point. I have tried to separate the particle system onto a separate canvas with a higher sorting layer, put it on a world canvas, put it in the 3D world separate from any canvas, etc. No matter what I do, it still shows behind the UI. Any help with this would be greatly appreciated.
If any more information is required, please let me know and I’ll update as quickly as I can. Thanks in advance.
Sorry for letting this slip. So the way that me and my team solved it was by putting the particle effects on a separate layer and created a new camera to render just that layer and put it on a higher depth and set it to not clear anything. So it is actually being rendered SecoND on the separate camera. Hope this helps.
Only if I set sorting layer to Default with order 0. Then Particles will be rendered in front of UI assuming they are in front of camera. No idea why it is so messed up…
I work out particles on UI by this:
as most of you have mentioned, your ui canvas should be scree space -camera / world, then you should give that canvas a sorting layer.
for position purpose, you should put your particle system in another canvas that have a sorting layer that will over your ui canvas
put a script on the particle system:
particleSystem.renderer.sortingLayerName = “particle”;
the “particle” layer here should be a sorting layer on top of your UI canvas sorting layer
And that’s work for me~
- if you want some of the UI over the particle, and some under them, you can create some more canvas and it also works.
- don’t know why the code editor here not work for me cannot post code
In my case I fixed this issue by:
Canvas: Screen Space - Camera
Camera’s culling mask is set to UI
Clear flags: Either depth only or don’t clear (both seem to work)
Particles are on the UI layer
Particle GameObject has the following script on it:
void Start ()
ParticleSystem ps = GetComponent<ParticleSystem> ();
ps.renderer.sortingLayerName = "Particles";
Sorting Layers are setup like this:
Layer 0 Default
Layer 1 Particles
To make world elements appear in front of the canvas you need the canvas to be in screen space - camera or in world space. In camera space you simply push the plane back. In world space you manually position the camera in the scene.