Hey Everyone,
I have a problem here that’s very frustrating, and I’m thinking (hoping) it’s because I’m doing missing something very obvious. I’m using Unity2D and I have a particle system. The problem is simple - The particle system runs and works, but the particle system displays behind every single gameobject. No matter what I do, I can’t get it to display in front of any sprite. In fact, it is even hidden behind the background.
In case you are saying to yourself, “This question looks familiar”, you are right! It’s been asked (and answered), but I have not been able to find a solution that works for me. The main solution I have found is to change the sorting layer name of the Particle-System. I have done that, but it does not work. Here is my code:
this.GetComponent<ParticleSystem>().renderer.sortingLayerName = "Enemy";
Does anyone have any ideas?
Thanks!
NOTE: I am using a Shuriken Particle System
This solved for me.
– GehrkeThank you, I never would have solved this on my own.
– BarbarianThanks a lot!! really helpfull =)
– NoninterferenceUnfortunately, this doesn't work in my case. For some reason, it won't take on that sorting layer unless I remove the SpriteRenderer and add it back (as mentioned in my answer). In general, though, this solution is the correct way to sort a particle system.
– Needlesslol im so blind i didnt see the there is order in layer there
– Kenwood