How to make a function wait for an event to fully finish executing?

Hello all,

I’m trying to animate the death of an actor in my Level Blueprint, by calling the Animate_Row_Death EVENT (custom event set up in the blueprint of BLOCK_ROW_PARENT), then immediately calling Destroy Actor back in the Level Blueprint (assuming that the event will fully finish executing first, before moving onto the Destroy Actor node). This can be seen below:


However, what appears to be happening is that the Event is firing in its own thread (or maybe the timeline is what begins the separate thread), and simply continues along its original execution path (shown above) in the Level Blueprint, which just deletes the actor well before the animation is finished:


I would obviously want for the timeline animation to finish, then have the Level Blueprint continue its execution path. Are there any workarounds to this? I can’t reference the Level Blueprint from my Block_Row_Parent BP, so firing off an event from within my blockrow parent is out of the question (plus, its a little dirty, the row shouldn’t communicate with the level BP). Could someone either provide a quick example or point me in the direction of one please?

Thank you very much, any help is appreciated!

One thing I notice is your timeline is set to 0.0 so of course everything happens only once and instantaneously. I assume you have tried to set the time limit higher and properly set up the timeline for the return values?

Nah, I confirmed it’s working by itself. It’s just that the event fires off in its own thread while it continues to execute the Destroy Actor node (before the event is done).

You could just tie a delay node to Destroy the Actor. Just set the delay time as long as your animation. Thats the quickest answer.

Hope that helps =)

If you could use an animBP you could probly trigger a bool or custom event from a cast to occur using the Time Remaining (ratio) node.

Destroy actor in level blueprints generally isn’t used often. Can you move it to the BP for the actor its destroying?

Your timeline could also be the issue. Latent nodes can be weird something.

Hope you track it down!

Unfortunately I can’t since the top picture in my OP is a function within my level blueprint, therefore I can’t add any latent functions to it

I haven’t looked into animation BPs, thanks I’ll check it out. Also why shouldn’t the level BP be destroying actors? I feel like level control from the level BP makes sense.

I know this is a bit old but it sounds to me like your architecture is wrong if you need to do this. Events are fire and forget, you don’t have any way of being notified when an event is done unless you call something at the end that will tell you that it’s done.

If you need to do something a the end (or during for that matter) an animation you would want to use an Anim Notify (Animation Notifies in Unreal Engine | Unreal Engine 5.1 Documentation). This is an event that will fire at a given point in time during the animation and allow you to destroy the actor then.

I think part of the issue here is you are trying to do this in the level BP. The pawn should have a health value (or a flag that says IsDead or an enum that has some sort of life state like Alive, Downed, Dead) and the Anim BP should read that and if dead then start the animation. On start of the animation have an Animation Notify event fire and that’s where you start your timeline from. We do similar stuff and that works for us.

2 Likes