Disable particlefx component (DEF-2267)

Today I found out that disabling of game object don’t disabled particlefx component.
Docs told me that it’s ok :

Note! Components that currently supports this message are:

Collection Proxy
Collision Object
Gui
Spine Model
Sprite
Tile Grid

And I can’t stop particles immediately, too.

What can I do in this situation? Have you plans to make possibe “disable” particles component?

Yes, personally I think all components should support the enable/disable message. I wonder what would be the best approach for you? Did you manage to set alpha of particles to 0?

2 Likes

No, I can’t do this, because not all my objects has particlefx component, and I have no possibility to check “if have_component(particlefx)” or something like this.
Now I remaking whole system to delete GO instead using “disable”

I created a feature request for this: DEF-2267

3 Likes

Ugh, has anyone found a workaround for this? I can’t figure out any way to hide or remove a particlefx component and all it’s particles immediately and it’s driving me nuts.

  • I tried setting the tint to a transparent color, as recommended in that other thread, but that doesn’t seem to affect already spawned particles.

  • Deleting the game object doesn’t remove already spawned particles (which is usually an awesome feature, but in this case it’s the opposite).

  • The only possible solution I found was to set the emitter’s emission space to emitter and move the game object off the screen, but I really need my emitter to work in world space.


Incidentally, I found out that:

  • Trying to set_constant() on a particlefx that is not playing gives an error: WARNING:GAMESYS: Particle FX to set constant for could not be found.

  • The emitter_state callback is very useful, but also gives you errors if you delete the game object before the last particle has died, and there’s no way to disable the callback before that happens.

3 Likes

You could temp disable render predicate for particles from drawing in the render script if that’s workable. Or make a special render target predicate tag for particles you need to go away asap.

4 Likes

Well, now that I complained about this I solved it by simply unloading and reloading the whole collection proxy. I had assumed that would cause a delay, but it my case it’s pretty much instantaneous, even on a web build.

@Pkeod Ah, that’s a good idea, thanks! I don’t think it would work in this case, since I might be immediately spawning identical particles, but I can think of a few other uses for that technique.

4 Likes

Is there any update or ETA on this issue? I also ran into it yesterday. I’ve “solved” it by moving my disabled game object out of the screen, but in my opinion, it’s a dirty hack and there should be a way to disable particle FX.

3 Likes

@Johan_Beck-Noren what would be the complexity in adding support for this. Is it a quickwin?

3 Likes

It should be pretty straight forward implementation-wise.

Will check with the team and any old design-docs next week to see if there were any reasons for not including particlefx as a component to enable/disable.

5 Likes

Sorry to revive this thread. Is there an update to this feature request?

I ran into the same issue yesterday. :slight_smile:

1 Like

See particlefx.stop() with the clear option enabled. It’s a recent addition.

2 Likes

Oh I was actually referring to the disabling of particlefx component when a game object is disabled