How to? Navmesh for multi scene setup

Hi,

in Unity 5 it is possible to combine scenes. So we’re using that possibility. But we’re not able to make astar work with it.

So the question is: How do I bake a navmesh for multiple scenes?

We have a terrain with trees and houses in one scene. Astar object is in a parent scene with buildings, but it ignores trees in the included terrain scene (child scene).

Hi

Sorry for the late answer.
I notice you mention trees. There may be a problem where it currently does not find trees. Is it only trees that are the problem or are there other things it does not pick up in other scenes?

Hi,

The problem is with trees only, as far as I can tell. Sometimes it fails and builds the nav mesh with paths across trees, but not all the time.

Huh. Not all the time?
Mind sharing a screenshot?

That’s what the developer said. I don’t have a screenshot. But let’s just assume it always fails, much easier :slight_smile: A fix for that should work even if it actually did not fail every time.

Ok.
I did some tests and it seems that Unity will only actually generate the colliders during runtime, not when outside of play mode. So if your graph is scanned at the start of the game, then it should work, but they will be ignored when outside play mode.

It takes a lot of time to generate the graph so we use Astar cache feature to generate it in advance.

Hi

You can actually generate the cache while the game is running. Clicking the Generate Cache button will save the data to a file, when you exit play mode, you can simply drag that file to the cache file in the inspector.

Naah…

As you see on the screenshot it does see tree’s collider. It just builds wrong paths around it. Almost all of the tree is avoided, there is a single path along bottom left part.

https://www.dropbox.com/s/5oyy7f6xsilxidy/astar.png?dl=0

Ah, you are using a recast graph.
I thought you were using a grid graph.

Maybe you should try reducing the ‘max edge error’, that will make it simplify the navmesh less aggressively.