For Loop + Delay problem

Can someone please explain why this setup is not working? I expected to have printed 6 hellos in 1.2 seconds

I can rout it in different ways and make it work but as I look this should work too

My guess is that the For Loop node doesn’t wait for the Loop Body to finish executing before the next loop. I think you should use timers instead of the For Loop and Delay node (such as the Set Timer by Event node)

1 Like

If you absolutely need to have a delay in a loop you can do it with a macro library function.

Macro needs to be of type Actor to get the delay node.



Or this:


I did this but it have no break, the post above you is giving me good idea I will do the same, but thanks for joining

Thats very nice!!! I will create it thank you

Loads of Catches & Gotchas that only experience can resolve.

1 Like

To explain the for loop issue a bit better, if you open up the for loop code, it actually consists of a sequence (this is shown in the modified for loop with delay). I’m not sure when it happened (maybe 4.6-ish) I think Unreal removed the ability to have delays in sequences… this is because the next pin automatically fires when a delay is hit - so it just passes through the delay OR gives erroneous behaviour. Similarly you can’t use delays in functions either. It would be just nicer if Unreal actually gave a proper warning (like most beginners, I’ve wasted hours trying to resolve timings only to find that delays aren’t working properly).

If you look inside the Do N node, it also relies on a sequence - does this really work? Unfortunately in my case, I needed to have a nested for loop (with multiple delays in the body) so the Do N node doesn’t work for me in either case.