Can I use two different graph types in a scene?

I want to use a Recast graph and a Point Graph for different systems in a single scene. Is this possible?

Also, for the Point Graph, is it possible to return the collection of ordered nodes for a calculated path? For example, say I have Nodes A → B → C → D. Is there a way to return a collection that says “The path from A to D is A, then B, then C, then D.”

Hi

Yes, you can do this.
It can be tricky to do so, however, since they will not be automatically connected to each other. You’d have to do that yourself (unless you want them to be completely separate).

Sure, by calculating a path (see Searching for paths - A* Pathfinding Project) you can access the ABPath.path field, which is a list of nodes. You can also access ABPath.vectorPath which is a list of node coordinates in the path.

1 Like

Thanks! Is there a way to get the GameObject or the GameObject name corresponding to the GraphNodes from ABPath.Path?

Hi

If you use a point graph that is created from gameobjects, then they hold a reference to the GameObject on the nodes themselves.

var node = ...;
var pointNode = node as PointNode;
var go = pointNode.gameObject;

See PointNode - A* Pathfinding Project