Particles Z-Order

I’m trying to make reward screen with Reward Icon (sprite), Glow Particles behind it and Stars particles in front of it. Is there a way to make particles with correct z-order? I found topics about custom render script, but looks like it’s not sutable for my case.

Are you using the particle effects in a Game Object, or a GUI? In Game Objects, particles are rendered in front of all other sprites, but in a GUI they are rendered in order of the nodes of the emitter, independent of z position.

So the easiest solution would be to do the whole reward screen as a GUI object, and putting the icon between the emitters.

I would say it is.

One possible way to obtain what you need is as follows. I am assuming that the particles appear in front of the sprites.

  1. In the render script, declare a new render predicate, let call it “particle_behind”
    self.particle_behind_predicate = render.predicate({“particle_behind”})
  2. In the render script add a line to render the new predicate before the sprite predicate
    render.draw(self.particle_behind_predicate)
  3. Create a new material cloning the default particle material, call it “particle_behind”
  4. In the new material change the tag to “particle_behind”.
  5. Change the material of the glow particles to “particle_behind”.

Ciao!

Thanks, now I’m using Game Objects. I’ll try with GUI instead