private void Update() { if (StartPosition.position != LastPoint1 || TargetPosition.position != LastPoint2 || GridReference.CanGoDiagonal != LastDiagonal) { GridReference.ForceUpdate(); FindPath(StartPosition.position, TargetPosition.position); LastPoint1 = StartPosition.position; LastPoint2 = TargetPosition.position; LastDiagonal = GridReference.CanGoDiagonal; } }