I am saving/loading scanned graphs into custom file formats, everything works fine, but now I’m trying to add pathfinding to ladders.
There is a single NodeLink2 for the each ladder, it connects the areas just fine after a scan, but loading this saved graph ends up completely breaking the system, see attached picture.
I found a workaround for the time being, manually re-activating each links gameobject, but I’m pretty sure I shouldn’t have to do that.
I have also noticed that loading works fine when using the ‘save to file’ and ‘load from file’ buttons on the A* Inspector. I am simply using
AstarPath.active.astarData.DeserializeGraphs(bytes)
to load but also tried
AstarPath.active.AddWorkItem(new AstarPath.AstarWorkItem(force => { var sr = new Pathfinding.Serialization.AstarSerializer(AstarPath.active.astarData); if (sr.OpenDeserialize(bytes)) { AstarPath.active.astarData.DeserializeGraphsPart(sr); sr.CloseDeserialize(); } return true; })); // Make sure the above work item is run directly AstarPath.active.FlushWorkItems();
which is the code behind the ‘load from file’ button, minus the inspector script calls.
Both produce the same error. Maybe the editor script is doing something that really should be in the deserialize methods.
Please ignore the linegraph nodes going up the ladder steps seen in the image, those are from an earlier attempt and were since removed.
As a sidenote: I have multiple overlapping navmeshes for different character sizes, but the NodeLinks only ever connects the very first MeshNodes it finds. I have made a class extending NodeLink2 which iterates over each graph and links areas from only that graph. The default link behaviour could probably use some improvement.
Hi
Yeah, NodeLink2 has not been possible to serialize previously. I haven’t seen it crash like that before though, are you sure that was not caused by some earlier exception?
Good news however is that I have written code to properly serialize and deserialize NodeLink2 in my dev version. I could send the updated version to you if you want.
A lot of things have changed in that release, but I think it should be relatively stable.
Hi!
Actually, I just noticed this error during saving:
When is the next release planned? I can probably wait for it, the workaround works for now. I don’t want to risk a potentially unstable version right now.
Anyways, glad to hear it’s already solved.
Hi
Hm, that looks odd. Potentially that could be caused by some other bug. If it is possible to replicate for you that bug, do you think you could share the project with me so I could debug that?
I am not sure when the next release is going to be, however I don’t think you should be that afraid for an unstable version, often my dev versions are more stable than the released versions due to the bugs that I have fixed (sometimes there are of course major new bugs introduced, but if you use version control it should not be a problem to revert to an old version of the package).
I will take you up on that dev version offer then.
The destroyed nodes issue happens when I deserialize nav data saved from an older version, that didn’t have the point graph yet, and try to serialize without scanning first.
I manually add new graphs and overwrite loaded graph settings after deserialization, so that maps made on older versions don’t get stuck on outdated graphs. Is there a built-in way to only deserialize the nodes and connections without changing the graph list or their settings?
Anyways, I will check if this still happens on the dev version, and share the project with you if it’s not fixed already.
Hi
Ok. Note that this update will not be able to load links stored using an earlier version of the system since there is some extra information that needs to be serialized that the old version simply did not serialize.
You can only either overwrite the currently loaded graphs, or you can append to it (using the Deserialize and DeserializeAdditive methods respectively). If you just want to upgrade some data, it should not be a problem to overwrite the list and then simply not save the scene.
I have sent you a PM with the dev version.