(c#) - For/Foreach loop skips indexes, jumping to different indexes at random??
tldr; Filled an empty list with coordinates via ListName.Add(); Then I get my unit to move to each position/coordinates, one by one, via loop, but the unit would instead skip an index(sometimes several) and move to a random coordinate.
I even put int a short delay to check. First pic's of the first loop through; Unit's suppose to move to first tile, but he instead moved to the 5th or 6th index. But the jump's not always consistent. Everytime I run the unit would jump to a any random coordinate recorded in the List :( I've tried both the For and Foreach loop - still jumps indexes.. What could be causing this?
Perhaps do this with a for loop. Guessing here, but I presume you are wanting to stop your loop at the point d >= 10f. ins$$anonymous$$d its resetting d and continuing. Perhaps break
from the loop.