Looks like some weirdness with using every X seconds and for each. I would try something safer like state = chase and unit is not moving along path, then find path. This removes every tick and every X seconds with pathfinding. Also there might be a better way to do your units that what I'm seeing with the two identical families, the picking looks really convoluted. In a game like that you may want to keep Enemies as a separate family to Friendly units. And the extra layer of confusion with spriteUID variable, it seems like there could be a simpler way.