How to rebuild a navmesh after generating a dungeon?

Hey,

I wrote a code that generates a level on begin play. The problem is that my AI canot use that level because I need to regenerate a navmesh.

I tried this, but It doesn’t work.

    NavigationSystem = UNavigationSystemV1::GetNavigationSystem(this);
    if (NavigationSystem)
        NavigationSystem->Build();

I see logs, but no results:

LogNavigationDataBuild: Display: UNavigationSystemV1::Build started...
LogNavigationDataBuild: Display:    Building navigation data using WITH_PHYSX.
LogNavigationDataBuild: Display:    Building navigation data using WITH_CHAOS.
LogNavigationDataBuild: Display: UNavigationSystemV1::Build total execution time: 0.00s

Only way I could make it work to make navmesh dynamic, but it doesn’t seem like an afficient way to do that.

Thank you.

Here, My purpose solution.
Set NavMesh RuntimeGeneration to Dynamic Modifiers Only and your level generator need to place NavMesh modifiers accordingly.

I tried to set this setting and spawn a navmesh modifier box on the map, it did not trigger an update. Is there a particular way how I have to do it?

Did the NavMesh visualization change when you spawn NavMesh modifier?
You can preview it here.

You can also set NavMesh runtime generation to dynamic but you will need to manually set bCanEverAffectNavigation on every collision.

Dynamic is only one option I was able to make working. Thank you.

I am strill interested to rebuild it manually with C++ after a level generation, but it looks like there is no solution yet.