// Update is called once per frame void Update() { if (IsPathfinding && FrameTimer < 0) { FrameTimer = TimeBetweenFrames; for (int i = 0; i < StepsPerFrame; i++) { int result = Pathfinding.NextStep(); if (result == -1) { IsPathfinding = false; Debug.Log("Unpog"); break; } if (result == 1) { IsPathfinding = false; Pathfinding.DisplayPath(); SetPathOfStart(); break; } } } FrameTimer -= Time.deltaTime; }