Download

How do we get duration of a particle system component ?

Hello guys,

I’m a beginner and still learning how Unreal works.
In my current C++ exercise, I have a pawn who will be able to place bomb. The bomb actor itself which will activate explosion particle effect after a period of time. After the explosion is finished, the bomb actor will disappear /destroy itself.
For explosion effect, I use P_Explosion from Starter Content.
The issue I currently have is how to know the exact duration of a particle system.

Right now in my bomb actor’s Tick method I perform checking to bWasCompleted member of my particle system component. It seems working but there’s a slight delay so I suppose there’s a better / more reliable way of doing this.
I tried to look for any callback method/event but I haven’t found it.

Thanks,

Anton

This isn’t a direct answer to your question, because I’m not sure if you can get the exact lifetime of a particle system as a whole. But I’m guessing what you need to do is delay the destruction of your actor to allow the particle system to complete.

I usually guess this length of time using a clock and then add a half second or so and then fire off a timer to call my destroy function after this length of time.

I’ve not looked at particles for a while, but I’m pretty sure you can just spawn an emitter not attached to your actor, and make sure that it destroys itself when complete. This would allow you to destroy the bomb actor whenever you’d like, the disappearance of which I imagine would be hidden by the explosion effect.

(Not sure of the function name, sorry!)

Hi hyperdr1ve and HateDread, thanks for your workaround idea. I’ll try.