It’s not a bug, it has to do with the render order of different materials, in your render script. If you look at builtins/default.render_script, you can see that in the update function it draws materials associated with the tile tag, then particle tag, then the gui. So z-order will only sort objects within those groups, not between them.
If you want certain particles to draw over the gui, you should:
- Make a local copy of the default render_script (because changes you make to builtins won’t be saved)
- Set the render in your project settings (bootstrap section) to use your custom render script
- Create a new material for particles you want to render over the gui (start by copying particlefx.material from builtins/materials)
- Open your version of particlefx.material, and in the tags field change “particle” to something like “particle_after” (or whatever you want, just keep it consistent with step 5)
- In your version of the render script, add this line to the init function:
self.particle_after_pred = render.predicate({ "particle_after" })
(the string you pass to render.predicate should match the tag you gave to your new material)
- In the update function of your render script, add these lines to the end:
render.set_viewport(0, 0, render.get_window_width(), render.get_window_height())
render.set_view(self.view)
render.set_depth_mask(false)
render.disable_state(render.STATE_DEPTH_TEST)
render.disable_state(render.STATE_STENCIL_TEST)
render.enable_state(render.STATE_BLEND)
render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA)
render.disable_state(render.STATE_CULL_FACE)
render.set_projection(get_projection(self))
render.draw(self.particle_after_pred)
- Finally, assign your custom particle material to any particlefx you want to draw on top of the gui.
This should solve your problem, and will hopefully give you a little bit of insight into Defold’s render pipeline.