Cannot update NavMesh when Batching Static is enabled

I've recently started learning how Unity's pathfinding works under the hood, by using the NavMesh Components From Github as an aid.

However, I've been experiencing a problem when static objects gets batched. Here is what my scene looks like:

Both, the "Ground" and "Building" objects have been declared as static objects. I use the NavMeshSurface.cs component to build the NavMesh. I then call the UpdateNavMesh() method from the NavMeshSurface.cs component in my custom component. This is what my code looks like:

NavMeshSurface updateNavMesh;

void Start ()
{
    updateNavMesh = GetComponent<NavMeshSurface>();

    StartCoroutine(NavMeshUpdateInterval());
}

IEnumerator NavMeshUpdateInterval()
{
    while (true)
    {
        yield return updateNavMesh.UpdateNavMesh(updateNavMesh.navMeshData);
    }
}

When I run my custom script, my scene crashes with the following error:
[quote]
RuntimeNavMeshBuilder. Source Mesh does not allow read access: Combined Mesh (root: scene)
[/quote]

I then disable Batching Static on all static objects and the scene runs perfectly fine without crashing. Is this perhaps a bug?

3324764--258954--Navmesh.PNG

i have same issue did u found any solutions ??

The issue you have both run into is due to an overlap in how the static variable has historically been used.

If your object has a navmesh on it and it flagged as static .. then its assumed to be part of a "global" navmesh that will be generated. However the new NavMeshComponent system is "componentized" and thus dynamic,

The error is basically saying you can mix the baked global mesh with the componentized one (and your object is basically flag to be both)

Static batch also uses the same static flag. However if your object has a navmesh on it.. its likely not going to be batched.


Yes. All I did was change 'Use Geometry' property from NavMeshSurface component to 'Physics Colliders'. Also ensure that all your obstacles have colliders attached to them

1 Like


Yeah, I thought it was some kind of bug. But when I opened up a report, the Unity staff told me all about it.