- Home /
Particle System In 4.6 UI
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.
I've spent about 5 hours trying everything on this thread and on other web pages and just can't get particles to render on top of the Unity 4.6 UI. Anyone had any success? I get the feeling the above solutions are for the older UI?
Answer by Nerull22 · Dec 18, 2014 at 06:03 PM
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.
This sort of works for me. Cleaner than many of the ideas I've seen so we'll probably stick with it. With this process I have to switch on the camera after the UI is shown for the particles to start rendering. Wonky, but it seems to work. Thanks!
Answer by Derek-Wong · Feb 08, 2015 at 01:06 PM
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
Answer by lilboylost · Dec 18, 2014 at 05:38 AM
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..
Answer by NeilM0 · May 08, 2015 at 05:50 PM
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
Answer by Kiwasi · Dec 11, 2014 at 06:06 PM
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.
I've tried this. I have the particle system on a screen canvas, and the UI elements on a separate screen canvas. And the UI elements canvas is way way way back away from the camera, and the particles are much closer to the camera. The particles are still behind the UI elements. I've also tried putting them on separate sorting layers to hopefully fix it, and the sorting layers didn't solve the problem either.
Edit: What I meant was that all of these were screen space - Camera's. Not overlays, if that was unclear.
I'm having the same problem. Did you ever manage to fix this?
Your answer
![](https://koobas.hobune.stream/wayback/20220613173819im_/https://answers.unity.com/themes/thub/images/avi.jpg)