public Path <Rectangle> FindPath(Vector2 startPosition, Vector2 endPosition) { if (graph == null) { Object.FindObjectOfType <MapBaker>().GetGraph(); } int startIndex = UtilFunc.GetGraphNodeIndexFromPosition(graph, startPosition); int endIndex = UtilFunc.GetGraphNodeIndexFromPosition(graph, endPosition); GraphNode <Rectangle> startNode = graph[startIndex]; GraphNode <Rectangle> endNode = graph[endIndex]; return(FindPath(startNode, endNode)); }