The Custom Graph Generator lost connections on version 5.06

I wrote a 2D platform graph based on PointNode. It worked well on version 4.2.17 (maybe 4.2.18). The update is finished, and I changed a little code because the scan function changed. I am below some code. Is there something I did wrong?

for (int i = 0; i < platformNodes.Length; i++)
                    //add Connections
                    int numConnections = platformNodes[i].LinkNodesID.Length;
                    var connections = new Connection[numConnections];
                    for (int j = 0; j < numConnections; j++)
                        connections[j].node = graph.BindCreater.GetPlatformNodeByID(platformNodes[i].LinkNodesID[j]).LinkPathNode;
                        connections[j].cost = (uint)(platformNodes[i].LinkPathNode.position - graph.BindCreater
                    graph.nodes[i].connections = connections;

//connections   number and   info  all correct there
//runtime add graph
var data =;
            if (data == null) return;
            var platform2DGraph = data.AddGraph(typeof(Platform2DGraph)) as Platform2DGraph;
            if(platform2DGraph == null) return;
            platform2DGraph.BindCreater = creater;
// scan
var graph = GetCacheGraphByCreater(creater);
            if(graph == null) yield break;
            foreach (Progress progress in {
                NLog.Log(this,"Scanning -- " +progress.ToString());
                yield return null;

//use Seeker.StartPath();
// Just Find One Node On Path, and this node connect is 0
private void OnPathComplete(Path p)
            NLog.Log($"Find  {p.ToString()},Is Error?  : {p.error}",NLog.LogLevel.Warn);

            foreach (var node in p.path)
                NLog.Log($"path Node ID : {node.NodeIndex}    Pos : {(Vector3)node.position}");
                node.GetConnections((n =>
                    NLog.Log( $"Connect Id  {n.NodeIndex}  ,  Connect  Pos :  {n.position}");
                } ));

I do a lot of work to debug, and I can confirm all nodes’s connections are 0.


The Connection struct needs a bit more information nowadays.
Use the Connection constructor to set all info:

connections[j] = new Connection(node, cost, isOutgoing, isIncoming);

For bidirectional connections, both isOutgoing and isIncoming should be true.

The GetConnections method also defaults to only returning outgoing connections.

1 Like