Support Forum

Additive load graphs baked in separate scenes

Hi -

My scene setup has a main scene with subscenes that are loaded additively. Ideally I wanted each subscene to have its own graph - meaning if I worked on a subscene I just need to bake its individual graph when something changed which would be much faster.

In order to do this I have an AStarPath component in each subscene for baking purposes - but at runtime I grab the graphs, kill the astarpath object in each subscene, and then additive load their graphs into the main scene’s singular astarpath object. This works fine, but the problem is when I bake a subscene by itself without its adjoining scenes loaded, it builds a border around the edge of the subscene, presumably because it thinks that is the edge of the map. But in reality, say if you have two adjoining terrain tiles, there is not a border where they join each other. I tried to hack it by putting in a simple collider along those edges in each subscene that the bake would include that would extend the navmesh into the adjoining navmesh once loaded. But while the navmeshes look ok at runtime (meaning, no gap), pathing will not go between them.

I could simply load all the subscenes in the editor and run a single bake for the entire navmesh. But this would be way less elegant.

Is this a supported use case or am I going to need to bake the entire navmesh at once?



The recommended way is to bake one single graph for the whole world. In particular near borders, individual “tiles” would actually need to know what is slightly outside the graph as well, but that cannot be done if you bake them on a scene-by-scene basis.