public IEnumerator FollowPath(int[] path) { moveCount = 0; Vector3 startPos = pathNodes[path[0]].transform.position; head.Teleport(startPos); foreach (int node in path) { SetDestination(node); while (!head.atDestination) { yield return(new WaitForFixedUpdate()); } moveCount++; } moveCount = 0; }