How to make the delay in foreachloop

i want to realize an effect that a ball can move following the trajectory i have accumulated.(when press the key f, the ball will appear at the location of this cube and move according to the green curve)

so i have accumulated each position of the ball will stay in the trajectory.(there are 10 locations stored in an array variable named “TracePoint”),i use a foreachloop node, and change the location of the ball in the loop body. In order to observe the ball. i use a delay node for 1second delay

and here come the question! in the debug mode ,we can see the program can reach the delay node but can never reach the setworldlocation node until the foreachloop completed. so the effect of the program is wrong: the ball appears at the location of that cube, delays for 1second and suddenly appears at the final position,it skips all the locations during the loop!

in another way , i use the timer in foreachloop for instead. but nothing changed.

so, how to make the delay in foreachloop? or is there anyway to realize the effect i want? any help will be really appreciated!

I think the typical way to do this is to copy the ForEachLoop macro into your own copy then add the Delay directly to the loop. You can get access to the ForEachLoops internals by double clicking on it, I must stress the importance of not modifying the original though so be sure to copy that to your own macro which you could create inside a Macro Library which will give you access inside any BP in that project you create.

oh!thank you very much!i have accessed the inside of the loop node,and i realize what the problem is:the loop counter and the array index are different variables and they increased in a sequence!No wonder!thank you very very much!

No problems, if you feel this adequately answered your question Id ask you to mark it as resolved please :slight_smile:

For anyone else that might read this you need to set up your own macro outside of the standard macros library or you won’t have access to the delay node.

These maybe inherently obvious to veterans but it was not to me.

I built my own macro, based on the foreachloop within my blueprint and the foreachloopwithdelay works great now.

You wont have access to the delay node in libraries extending from Object as its only available at Actor level.

I did stress the importance of not modifying the original files that come with the editor.