Creating Navigation System from Road Graph in Editor


I’m implementing a system that automatically generates a navigation system (NavMeshBoundsVolume + NavModifierVolume) from a street graph obtained from .shp files. What I’m trying to achieve is to spawn a global NavMeshBoundsVolume to cover the entire scene + for each street in the graph a NavModifierVolume.

This generator is part of a larger environment generation pipeline and is supposed to be executed in the editor (so no runtime). The code is invoked via a PostEditChangeProperty callback.

I’ve tried spawning the NavMeshBoundsVolume with
ANavMeshBoundsVolume* navigationVolume = GetWorld()->SpawnActor<ANavMeshBoundsVolume>(ANavMeshBoundsVolume::StaticClass(), transform, parameters); CubeBuilder cube = NewObject<CubeBuilder>(navigationVolume); cube->X = size.X; cube->Y = size.Y; cube->Z = size.Z; navigationVolume->BrushBuilder = cube; cube->Build(GetWorld(),navigationVolume); GetWorld()->GetNavigationSystem()->OnNavigationBoundsAdded(navigationVolume);
This, in fact, does spawn the actor in the scene but fails to generate the cube (size is not 0) and create a navigation system. I’ve tried similar approaches for spawning ANavModifierVolumes, incuding the use of an already existing template volume. Can anyone point me in a good direction on spawning such actors with C++ in the editor? Cheers, Jimmy