- Home /
Particle System is not respecting sorting layer
I'm making a 2D game and I have this sorting layers:
Background
Main Game
Effects
UI
Every item it has its corresponding layer. I created a particle system and put "Effects" in the Renderer -> Sorting Layer. Some particles shows BEHIND some Main Game elements and some particles show ABOVE some UI elements. In fact, particles pop from behind the UI elements, show for a little, and go back to the back of UI. So Im thinking this issue is not about sorting layers but Z value. I played with the values of the particle system, the UI and the Main Game elements but Im not getting the desire effect. Just render the layers in the order I set them.
Also I wrote and script and attached to the particle system with this line on Strart() this.GetComponent().sortingLayerName = "Effects"; but the problem still there. Also, there is a difference with the particles showing in the scene view and in the game view (even when the game is not running).
What Im doing wrong?