- Home /
Render particles in front of any sort layer (2D sprites)
Hi, can someone help with this? i have sprite renderer with default sorting layer and order in layer = 0; but particles (ellipsoid PE) rendering behind this sprite - it is possible to make it render in front of sprite? moving on Z position didnt help
Answer by RTSeegrist · Dec 28, 2014 at 07:44 PM
Everyone wants to mess with sorting layers when all you have to do is create a separate camera for particles and give it a higher depth than the camera that is rendering your sprites. I have three cameras in my game. The main camera for sprites, a particle camera for particles, and a UI camera for UI elements.
The main camera has a culling mask of Default, Transparent FX, Ignore Raycast, and Water and a depth of 0. The particle camera has a culling mask of Particles(user created layer) and a depth of 1. The UI camera has a culling mask of UI and a depth of 2. All three of the cameras have the same transform(5,3,-10) and are all Orthographic. The main camera has a Clear Flags of Solid Color and a black Background. The other two are Depth Only.
I put all sprites on the Default layer, all particles on the Particles layer, and all UI elements on the UI layer. It is important to make sure your particles have a Z transform that is within the camera's view. I set mine at -5.
Every other camera brutally hits performance on mobile platforms, even if it has nothing to draw. I'm not sure why, but keep it in $$anonymous$$d.
That seems to work if you want to put all your particle systems on top of UI and Sprites. But what if you want to put particle systems in a specific sorting layer, so let's say, it draws under "characters" layer but over the "background" layer. That is my case. I need to find another solution.
Answer by 77 · Jul 01, 2014 at 01:29 PM
done, solution here work good http://answers.unity3d.com/questions/577288/particle-system-rendering-behind-sprites.html
Answer by nextage575 · Dec 30, 2019 at 07:51 AM
If anyone is looking for its answer , follow the first answer of this link.Link
Your answer
Follow this Question
Related Questions
Need more flexible sorting layers 1 Answer
Unity 5: MeshRenderer and SortingLayer not working? 6 Answers
[2D] [C#] Sprite disappears after changing position 1 Answer
What is sortingLayerID used for? 2 Answers
value range of Sprite sortingOrder 0 Answers