Request for no list version of IsPathPossible(List<GraphNode> nodes, int tagMask)

Need to check if two nodes are connected with a specific tag, found the method: IsPathPossible (List nodes, int tagMask). do not want to pass a List variable since it will create a List for every single call of IsPathPossible or I have to declare a List as a class member to avoid impacting gc. will you add a method like this in the next update: IsPathPossible (GraphNode node1, GraphNode node2, int tagMask)


Thank you for the suggestion.
The method that takes a tagMask will have to do a very expensive search anyway. So the tiny amount of GC from creating a list should be insignificant in comparison, I believe.
You can use the Pathfinding.Util.ListPool class if you want to reuse the list.

“a very expensive search”

  1. But the search should be less expensive than the real path search with penalties in the Seeker?
  2. And if I do not use the IsPathPossible (List nodes, int tagMask), directly set the agent’s destination without knowing if the destination is reachable from the agent’s current position, how can I know if it is reachable after the path is completed (I think there are some callback functions for me to check the path, but which one should I use? )
  3. When I get the completed path, just check the path.error, if path.error = true then it means it is unreachable?
  1. Yes. Most likely, it’s faster. Though since it will run in the main thread, it may still be desirable to start an async path request.
    2/3. This depends on various settings. If the path is blocked by a tag, or no reachable target node could be found within A* Inspector → Settings → Max Nearest Node Distance, then the path will fail with an error. Otherwise, it will calculate a path to the closest point it could reach.