- Home /
2D renderer with particles on UI
As far as I can read, the 2D renderer doesn't support camera stacking. Is there any way to get particles on top of UI elements?
Or is an updated planned in the future to support it?
Thanks!
Answer by micah12 · Nov 13, 2020 at 11:46 PM
I was able to do it just now with stacked cameras. I created an additional overlay camera with the culling mask set to only UI. I created a 3rd overlay camera with the culling mask set to a custom named layer I called UI Particles. I added these both to the main camera stack. In my UI, I added a particle system object under one of my buttons. I set the object's layer to "UI Particles" and it draws above all of the UI. I'm not sure how slow 3 cameras will be but you can try it out.
Thanks! Are you sure you are using the 2D renderer? Would you $$anonymous$$d checking what version of URP you have in the package manager and what Unity version? I read somewhere that camera stacking was available in a preview of URP but not sure which.
I'm currently using 2020.1.10f1. $$anonymous$$y URP says version 8.2.0. I tried following peoples posts about getting particles in UI but none of them were working until I thought to create the 3rd camera to put in the stack. Oddly I can even move an image with a particle system component to my "UI particles" layer and it will still render correctly. I'm pretty sure there is a bug in 2D but this lets me move forward. I should add that the canvas is set to screen space - camera with the render camera set to my UI camera.
Canvas - set to UICam $$anonymous$$ain Camera - stacked to include UICam and UIParticleCam UICam - culling set to just the UI layer UIParticleCam - culling set to just the UI Particles layer
Edit: added more details
Very interesting, not sure why $$anonymous$$e didn't work then. I also have 8.2.0 which seems to be the latest non-preview version, and I can't see how to install preview packages either, without maybe upgrading Unity. Could you create a simple repro scene that shows that it works? If you can email me at bluegoo (insert at sign) nicmar.nu I'd be super grateful. I'll accept the answer for now anyhow. :)
EDIT: I can't show anything from the stacked cameras even with your 3rd camera trick, when I have canvases set to Screen space - Camera, so I gotta try upgrading to a newer Unity (have 2020.1.4) and see if I can get it working in a blank scene.
I can confirm that it worked, in a new clean project with both 2020.1.4 and 2020.1.13. I only had one stacked camera and the particle system is in the UI layer. I had to set the Order in layer of the particle systems renderer module to make it appear in front.
Thanks again for your help :)
SUPER I$$anonymous$$PORTANT: In the 2D Renderer Asset, enable "Use Depth/Stencil buffer" and it will work! (Please add this to the answer to help future searches :)
Your answer
Follow this Question
Related Questions
Particle System: How To Control Axis? 0 Answers
switching camera between panels canvas 1 Answer
How to display UI Text on GameObject in script? 0 Answers
Particle effect sorting around a 2d sprite 3 Answers
Blast Particle Gets Cut Off 0 Answers