public List <Vector3> FindPath(Vector3 startWorldPosition, Vector3 endWorldPosition) { grid.GetXY(startWorldPosition, out int startX, out int startY); grid.GetXY(endWorldPosition, out int endX, out int endY); List <PathNode> path = FindPath(startX, startY, endX, endY); if (path == null) { return(null); } else { List <Vector3> vectorPath = new List <Vector3>(); foreach (PathNode pathNode in path) { vectorPath.Add(new Vector3(pathNode.x, pathNode.y) * grid.GetCellSize() + Vector3.one * grid.GetCellSize() * .5f); } return(vectorPath); } }