Problem Spawning ANavMeshBoundsVolume in editor

Hello, I am currently creating a plugin, where if I click on the button, it will spawn some static meshes as well as an ANavMeshBoundsVolume on an empty map.

Initially, I have tried something like



   ANavMeshBoundsVolume* BoundsVolume = World->SpawnActor<ANavMeshBoundsVolume>(
      ANavMeshBoundsVolume::StaticClass(), FTransform());


It does give me an ANavMeshBoundsVolume, But it was not functioning at all. I have noticed that the “Brush Settings/Brush Shape” in details is missing compared to when I drag a Nav Mesh Bounds Volume from the left panel.


(The Icon looks different)

So I did some search online and tried adding:




   UCubeBuilder* CubeBuilder = Cast<UCubeBuilder>(GEditor->FindBrushBuilder(UCubeBuilder::StaticClass()));
   CubeBuilder->X = 200;
   CubeBuilder->Y = 200;
   CubeBuilder->Z = 200;
   CubeBuilder->Build(World, BoundsVolume);

   BoundsVolume->BrushBuilder = CubeBuilder;



Still, It does was not functioning at all.
But a least this time it has the identical “Brush Settings/Brush Shape” in detail.

And this thing shows up:

I have also tired SpawnActorDeferred, no effects at all. It seems like the problem is because of the volume actor’s collision component was wrong some how.

I am not sure what I can do with it. I have been stuck on this for two weeks already.

1 Like

Are you still having trouble with this? If so I had some luck with the following:



FTransform NavMeshTransform = FTransform();
NavMeshTransform.SetScale3D(FVector(500, 500, 500));
NavMeshTransform.SetLocation(FVector(0, 0, 0));

ANavMeshBoundsVolume* BoundsVolume = GetWorld()->SpawnActor<ANavMeshBoundsVolume>(ANavMeshBoundsVolume::StaticClass(), NavMeshTransform);

UCubeBuilder* CubeBuilder = Cast<UCubeBuilder>(GEditor->FindBrushBuilder(UCubeBuilder::StaticClass()));
CubeBuilder->X = 200;
CubeBuilder->Y = 200;
CubeBuilder->Z = 200;
CubeBuilder->Build(World, BoundsVolume);
BoundsVolume->BrushBuilder = CubeBuilder;


** Make sure “UnrealEd” and “NavigationSystem” are added to your Build.cs PublicDependencyModuleNames

1 Like

i am tried it in 4.24 , but not work :frowning:
is there any other setting i missed?

Have you figured out how to do it?