How to use for each loop with move component to

as the title suggests and as u can see in the body, this does not work. i can not figure out how, what exactly is happening is that i’m trying to move all the components in an array of components called “sprite array” using the for each loop but all it does is the first component of the array ignoring the rest or just not doing anything, though when i did a print string it seems it was activated every time it simply only moved the first one.

hence why i believe it is not just the for each loop not working as intended but rather the combination of the move component with the for each loop however how to solve this problem i am unaware of. hence this question.

any help would be greatly appreciated.

That function is latent. As such, it will not execute the other things until it’s “Completed”, pretty much, you can’t do what you want that way, because even though yes, it’s getting input each time from each component, one “process” is occurring, and the new one cannot start until it’s over. Even putting it at 0, means nothing, since, it’s all happening so fast that frame or two (the for each loop)

What you could do is this:

Just run a sequence and multiple MoveCompTo. I just tested it and it works.

1 Like

Each sprite in that array needs to be it’s own blueprint, and each of those blueprints need a custom event called and have it’s root component targeted in a move component to. Then you can move multiple times by targeting that blueprint and calling that custom event each time in the for-each loop. I ran across this same problem and that’s the solution.
You can only really “move component to” once per blueprint. Think object-oriented here. Each object can have a move component to firing once at a time. So make each object move it’s own component, and so make each object it’s own blueprint.

Each sprite in that array needs to be it’s own blueprint, and each of those blueprints need a custom event called and have it’s root component targeted in a move component to. Then you can move multiple times by targeting that blueprint and calling that custom event each time in the for-each loop. I ran across this same problem and that’s the solution.
You can only really “move component to” once per blueprint. Think object-oriented here. Each object can have a move component to firing once at a time. So make each object move it’s own component, and so make each object it’s own blueprint.