Additive loading of new graphs / navmeshes

Hello,

So, have the basic pathfinding integrated into my game so far, no issues there at all (very easy to integrate btw, thank you in advance).

My question is regarding additive loading of new areas / pathfinding graphs into the scene at runtime.

The basic design of the game is that I have a main ‘master’ scene that gets loaded first. This is the ‘hub’ scene. The hub has various triggers that will teleport the player to the sub-area locations as the player explores.

Something like so:

  • exterior (hub)
    • interior 1
    • interior 2
    • interior 3

and so on.

My goal is to load the main hub scene and all subsequent locations additively in Unity so that I can edit & stream them to the user independently (Each sub-location will end up being an assetbundle)

In the docs, there is the references to the saving & loading of graph data at runtime - would this suffice for what I’m trying to do here?

The nice thing about the system is that there aren’t any real ‘links’ between the locations - the player will basically teleport from one location to another and continue along their merry way - but I will need some way to trigger the activation / deactivation of the new sub-area graph and so on.

Has anyone tried this kind of additive loading of sub-graphs? Thoughts about the best way to organize this?

Each new area has it’s own navmesh, that part is easy - just kind of confused where to start with activating / deactivating the pathfinding for each area.

Is something like this all I need to do? Basically store a reference to my graph and then deserialize it on activation?
`
public class TestLoader : MonoBehaviour {

public TextAsset graphData;

// Use this for initialization
void Start () {
    AstarPath.active.astarData.DeserializeGraphs (graphData.bytes);
}

}`
(from http://www.arongranberg.com/astar/docs/save-load-graphs.php#saving)

Thanx in advance,
Mike W
http://indiedeveloper.ca

Hi

If there is an instantaneous teleport, then yes, that is all you need to do.
That call will remove previous graphs, which I think is what you want, but there is also an additive call to deserialize (check the docs on AstarData).