Looping through data table rows.

So i have a blueprint that gets x- and y- coordinates out of a data table and then moves objects to the locations. After that it stops. How do i make a loop that repeats the same process for the next row and so on?

The loop isnt working. Did i make a mistake?

Looks correct. What do you mean by not working?

My objects are not moving anymore. If i set the row name manually their moving to that 1 location. But with the loop nothing is moving.

you can do something like that, such that it only go to the next row index when the object has reached the current location coordinates:

I moved the objects with “Set Actor Relative location”. It doesnt work with “move to location or actor” note


Is it not possible to loop the Set actor relative location?

when using the Move To, it required the setup of a nav mesh.

if you doing a Set Actor Location directly inside the loop body, the for each loop will do everything at one go, so you will see only the last index location.

1 Like

When i try it with a “For each loop” and connect a print note to “completed” it instantly prints. It seems like there is a problem with the array bc. the loop instantly finishes before it even executes.

yes that how for each work, it will do everything at one go.

so you will need to do a manual loop with an event that will tell (on destination reached)

you can also use a timeline with a lerp to move your object and when it completed, call the next location.

2 Likes

Im already moving the objects with a timeline and lerp. how do I call the next location?

Assuming this is still the same thing.

2 Likes

just like everynone just posted but with a custom event at the begining and a call that custom event after the ++

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.