+1 vote

I can't see any signals on Particle2D. How do I know when the animation is done to free the Particle2D?

in Engine by (175 points)

1 Answer

0 votes
Best answer
    if not is_emitting():
        queue_free()

That's how I do it with my explosions

by (223 points)
selected by

Hmm I am also using is_ emitting it looks like this removes the Particle before the animation is completely done.

I haven't noticed that, You are using queue_free() instead of free() correct?

alexholly, I also experienced this when explosiveness was set to 0. Then there is some small time lag before the particles start emitting and node was freed before the action. Set it to 0.001 solved this problem.

dc1a0, I was using free() and now tried queue_free() still the same...

lukas,I can only set explosiveness to 0.01 now the animation looks different and disappears while the animation is still running.

I think a signal is missing, using is_emitting() is also not good for the performance.

alexholly, well, if your running it that long, you could time how long it runs and with that info, you could either have it start a timer, (or just use a counter as I would do,) to give it the time you need befroe freeing.

edit: for example, say your particles traveled for .5 seconds:


var lifetime = .5
var time = 0
var start = false
func _process(delta):
if not is__emitting():
start = true
if start:
time += delta
if time >= lifetime:
queue_free()

give or take - done off the top of my head.
Also had to give "is_emitting" an extra "_" because it wanted to italicize for some reason.

Yes, something like this would work but looks also like a workaround.
I accept this as a answer but also open an issue I think godot should support this.
thanks.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.