Question about order of events

In the first screenshot, are you in a loop ?
It looks like you have a single loop where, for each unit, you set its position and then define valid moves. But those moves depend on other units, which haven’t been positioned yet (because loop works item by item).

There is no slower/faster execution concerns here, everything happens in an instant frame execution sequence. It’s just the logic that is flawed. The delay fixes this “magically” because of how it’s designed which would take a while to explain, but as a result it should work just as fine even with a delay of 0.01 and shouldn’t need any fine tuning, it’ll just delay execution until next frame which is far enough to ensure the loop is done executing (= all units have been positioned).

A proper solution (without delay) would be to make two loops. Make a Foreach loop to position all elements, then, from the loop’s Completed pin, make another loop where you define their valid moves.

1 Like