Support Forum

Point graph G cost

I have another project that is using a point graph with custom links and a seeker. I see that when setting “Path Logging” to “Heavy”, the console displays the G cost for the end node. How can I get access to that number?

I have made some progress but it doesn’t make any sense to me. I tried making a custom traversal provider but that was not helpful. I tried iterating through the path nodes but none of the G costs matched what was in the logging output:

for (int i=0; i < p.path.Count; i++){

Then I modified this code from the docs:

public GameObject end;
var node =;
var pointNode = node as PointNode;

if (pointNode != null) {
} else {
    Debug.Log("That node is not a PointNode");

This finally provided the right G cost but I don’t understand why that node is not in the list I iterated through.


You can access the G score for the end node as:


In your code you were trying to access the path nodes by an index in the returned path. This doesn’t work because it is supposed to be indexed by the unique ID of the node.

Note that the G score field may be overwritten by the next path calculation. So you can only access it safely if you assign the path.immediateCallback field when you create the path. Note that this callback may be called from a separate thread.

Yes I see my error. I have simplified it a bit and removed the iterator, since the end node is always the last node:

gCost = p.pathHandler.GetPathNode(p.path[p.path.Count - 1]).G;

The path is created by the player when they place a building so I only need the last path calculated.

Thanks for your help. The point graph is working well but I’m encountering mysteries on the regular so I’ll be asking more questions as they pop up.