public static List <Vector3> FindPath(GameObject start, Vector3 end) { var realStart = start.GetComponent <Waypoint>(); if (realStart == null) { realStart = Waypoints.FindNearestWaypoint(start); } var realEnd = Waypoints.FindNearestWaypoint(end); return(BreadthFirstSearch(realStart, realEnd)); }