Connecting Nodes in a Point Graph during Runtime

Hi,

So I’ve stumbled across the problem that by using AddNodes() and ConnectNodes() I’m not able to properly fill the point graph structure during runtime. I noticed this, as the provided AI scripts don’t find a path when I do the aforementioned. But when I use the Scan() method all work fine. My issue is that I can’t really use Scan() as it does too much, i.e. connect nodes that shouldn’t be connected yet, searches them by tag and only uses game objects that are currently used (I utilise pooling for tiles so points of previous one’s disappear when scanning as they have been unloaded by a chunk system, their path information should be retained tho).

I did find the following in the documentation:

Point graphs will recalculate all connections that passes through the bounds. It will however not look for new nodes that are added as GameObjects. For that you need to use AstarPath.Scan.

Though I feel like the above does not apply to me as I add the nodes through scripting and not simply by instantiating a new game object?

My question therefore is, how can I correctly build up the graph structure of a point graph during runtime, just by using AddNodes() and ConnectNodes()?

P.S.: Visually this looks fine as the debug gizmos actually show the correct connections between my points.

€: I debugged the connections and amount of nodes in the graph and I’m getting the correct values on all of them.

Alright, think I solved it … It was just that I wasn’t executing ConnectNodes() in a work item.