Function PathUtilities.GetReachableNodes

GetReachableNodes (GraphNode seed, int tagMask=-1, System.Func<GraphNode, bool> filter=null)

Returns all nodes reachable from the seed node.

Public Static
List<GraphNode> GetReachableNodes (

GraphNode

seed

The node to start the search from.

int

tagMask=-1

Optional mask for tags. This is a bitmask.

System.Func<GraphNode, bool>

filter=null

Optional filter for which nodes to search. You can combine this with tagMask = -1 to make the filter determine everything. Only walkable nodes are searched regardless of the filter. If the filter function returns false the node will be treated as unwalkable.

)

Returns all nodes reachable from the seed node.

This function performs a DFS (depth-first-search) or flood fill of the graph and returns all nodes which can be reached from the seed node. In almost all cases this will be identical to returning all nodes which have the same area as the seed node. In the editor areas are displayed as different colors of the nodes. The only case where it will not be so is when there is a one way path from some part of the area to the seed node but no path from the seed node to that part of the graph.

The returned list is not sorted in any particular way.

Depending on the number of reachable nodes, this function can take quite some time to calculate so don't use it too often or it might affect the framerate of your game.

Return

A List<Node> containing all nodes reachable from the seed node. For better memory management the returned list should be pooled, see Pathfinding.Pooling.ListPool.