Crash while using while loop with delay in blueprints

I am trying to put a delay in my animation blueprint to smooth the animation in my game and when I add a delay to the loop to do so it will crash the game. I am able to put the delay anywhere else in the loop and it works(but doesn’t do anything no matter what I set it too). when I put it right after the loop in the picture it crashes the game. Is this a bug with the engine or is it my mistake?

Hey Aeson,

Thanks for your feedback. The issue you are experiencing occurs because the WhileLoop is not currently able to process Delays or Timelines within the Loop Body. I have entered a request for a WhileLoop mode with a built in Delay so that users can set a Duration between each loop.

In the meantime, there is a work-around you can try. If you double-click the WhileLoop node, you’ll see how the Macro is setup: a Branch node checks the condition and then runs to a Sequence node to process the Loop Body. You can set up the WhileLoop manually and include a Delay between the Branch and the Sequence.

It’s a bit convoluted, but this should work for you. The Branch checks your Condition, and while it’s true it runs to the Delay. It then goes to the Sequence to process the rest of your Loop Body, then goes back to the Branch to check the Condition again.

I hope this helps. Please let me know if you have any questions.

Best,

Ben Halliday

1 Like

This is really helpful! Thank you for the BP example. I finally got my function working as intended.