How to load saved graphs at runtime / Am I using the best method?

Hello!

In my game the player explores large prefab level chunks, and when they move from chunk to chunk, the previous chunk is deactivated and the new chunk activated. I would like to be able to create a recast graph for each prefab chunk, save it in editor, then associate that saved graph with the prefab so it can be loaded at runtime if and when the player enters the chunk.

  1. Does that seem like an appropriate way to deal with the issue?
  2. How do you hold a reference to the pre-saved Byte array? I want to use AstarPath.active.data.DeserializeGraphs(bytes);
    but I have no idea how to give the prefab the reference?

Hi

You might want to check out the example scene called Procedural, which has another solution for this.

There’s no easy way to load navmesh chunks like that. You can save and load whole graphs, but then you’ll still need to handle the borders between the chunks.

You can save these in a file with the .bytes extension. Unity will then make that available to you as a TextAsset in your project.