Hi,
I’m using Point Graph with Root transform with some children transforms to generate connections grid. Is there any chance to access those children having a reference to single GraphNode. A thing I’m working on is highlighting path after it’s calculation has been made using Seeker class.
Hi
Yes, you can cast the node to a PointNode (the class that the PointGraph uses) and then access the gameObject field.
var node = AstarPath.active.GetNearest(transform.position).node;
var pointNode = node as PointNode;
if (pointNode != null) {
Debug.Log("That node was created from the GameObject named " + pointNode.gameObject.name);
} else {
Debug.Log("That node is not a PointNode");
}
See https://arongranberg.com/astar/docs/pointnode.html#gameObject
Thank You !!! It works !!
1 Like