Baking Navmesh at runtime ignores 'Include Layers' property.

Hi,

I already asked this question on the NavMechComponents github issues, but no response. So im asking here too.

Please see the link for info…
https://github.com/Unity-Technologies/NavMeshComponents/issues/72

When i bake a navmesh at runtime it appears to ignore the ‘Include Layers’ property in the navmeshsurface component. This creates an unusable navmesh as it goes around the agents. When baking the navmesh offline using the ‘Bake’ button on the surface component it works as expected.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class NavigationManager : MonoBehaviour
{
    public NavMeshSurface surface;

    public void Rebake()
    {
        if (surface)
        {
            surface.BuildNavMesh();
        }
    }
}

I have the same issue.

It’s kind of a bad solution but you can do something like create a script to enable whatever it is after your navmesh is baked. That’s what I’m already doing for some of my stuff. Basically just disable it and then have it become enabled after the navmesh is baked. Not perfect and very late.