Any way to clear all particles from scene instantly?

I have some particle emitters in my scene, but when the player dies the scene reloads. When it does, the particle limit is hit since I think the old particles aren’t being cleared out for the new ones to spawn. Is there some way to instantly remove all particles?

If you make your scene a collection proxy, it should remove everything on reload.

I’m doing that already… Not sure what needs to be done to fix it. The particles I have have a fairly long lifetime. I’ll probably have to mess around and see if there’s some workaround. Not sure :stuck_out_tongue:

I’ve submitted an issue about this on github: https://github.com/defold/defold/issues/5265

It hasn’t been reviewed by the team yet, but on the assumption it’s possible to do then giving it a :+1: reaction would put it higher on the list of priorities.

5 Likes

Discussing it now! It’s an often requested feature.

6 Likes

In all similar situations my solution to this is to set the particle color to full transparent black.

2 Likes

I remember reading that moving the particles outside the render scope (say, z -100) also works.

1 Like

I can confirm this works! Really handy when you don’t want to unload the collection proxy.

particlefx.set_constant("#particlefx", "splat", "tint", vmath.vector4())

Fyi: I wasn’t able to get this to work. I tried setting both the game object and the particle component with no luck.

2 Likes

+1 :slight_smile: