public Vector3 GetCurrentWaypoint() { if (_path != null) { if (currentWaypoint == null) { if (reversePath) { waypointIndex = _path.GetPath().Count - 1; } } currentWaypoint = _path.GetWaypointAtIndex(waypointIndex); return(currentWaypoint.position); } else { Debug.LogError("No path set for" + gameObject.name); return(Vector3.zero); } }