Problems with loading graphs at runtime. (inconsistent results)

Hi Aron.

Following your advice regarding streaming in levels, we created a large recast graph, with a few nodelink2 connecting some doors/stairs, and saved it off to a file.

Loading the file works fine it seems, the inspector & scene view verify this.

However, when coming to actually request paths, and moving around, it appears the the links cause a “merge” of the nav mesh, as agents no longer receive the path between the links as a RichSpecial part, and if fact, just walk right through the walls, ignoring the fact it is there anymore.

This doesn’t happen when i have the graphs in editor, and perform a scan on awake, in this case, the agents receive the correct path, and traverse the links correctly.

Any insight as to why this happens?

after further testing, it appears the issues persists if i try and cache the graphs for startup as well.

the only solution seems to be to scan the graphs at startup, which doesn’t work for us as we are streaming in most of the level, but need to be able to have the AI pathfind through areas that are not loaded.

@aron_granberg
Aron, are you aware of issues using loaded graphs as opposed to graphs that are serialized with the Astar object? could the issue be that there are 2 graphs, one for links (a point graph, created automatically) and the actual recast one?

Hm…
This is something I have not thought of unfortunately.
The NodeLink2 requires a special node type, but the type of the nodes are not saved with the graph…
I think what you can do to solve this is to disable all NodeLink2 when scanning the graph for saving, and then right after loading the graph during runtime, you enable all NodeLink2 scripts, that should make the connections not be saved with the graphs, but they will instead be calculated after load time.

PS: Sorry for the late reply

please remove this spammer

This doesn’t seem to work. first, if i disable all the links around the level in order to save the graph, and have to re-enable them at runtime, it creates an issues since i have to keep track of all of them myself (not ideal).

even if i do so, i load the graph, re-enable the nodes, but i don’t get any connections, and cannot path find via the connections.

Is there a step i’m missing?

@aron_granberg

any ideas on how to resolve this?