Hello everyone!
I have come upon a rather frustrating problem which I am almost certain might be a bug. However I’d like to confirm that I didn’t screw up somewhere along the way.
I have been generating NavMeshes on Runtime for a procedural dungeon. For this purpose, The runtime navmesh generation inside the project settings is set to “dynamic”.
Upon spawning a room, the following code is executed :
if (m_bNavigationNeedsRebuild) {
// Build navigation
FActorSpawnParameters SpawnInfo;
FVector location = m_boxVolume->GetComponentTransform().GetLocation();
FRotator rotation = m_boxVolume->GetComponentRotation();
FVector scale = m_boxVolume->GetScaledBoxExtent();
m_currentNavMeshBoundsVolume = Cast<ANavMeshBoundsVolume>(GetWorld()->SpawnActor(ANavMeshBoundsVolume::StaticClass(), &location, &rotation, SpawnInfo));
UBrushComponent* Brush = m_currentNavMeshBoundsVolume->GetBrushComponent();
Brush->Bounds = FBox(location - FVector(scale.X, scale.Y, scale.Z), location + FVector(scale.X, scale.Y, scale.Z));
GetWorld()->GetNavigationSystem()->OnNavigationBoundsUpdated(m_currentNavMeshBoundsVolume);
m_bNavigationNeedsRebuild = false;
}
The rescaling of the brush happens in order to adapt the size of the navmesh to it’s parent blueprint.
This method works very reliably inside the UE 4.16.1 Editor. However, as soon as I package the game (Win 64x) all my AI Agents refuse to walk around. Typing “show Naviation” into the console reveals that there is no nav mesh, and “Rebuild Navigation” doesn’t have any effect whatsoever.
Is there any possibility that maybe unreal ignores the RuntimeGeneration: Dynamic flag when packaging?
Best regards and thanks in advance for any ideas you might have.