Any way to clear all particles from scene instantly?

#1

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?

0 Likes

#2

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

0 Likes

#3

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:

0 Likes

#4

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.

3 Likes

#5

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

5 Likes

#6

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

2 Likes

#7

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

1 Like

#8

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