Hello,
We’re using the PCG system and at the end of generation, we pop multiple NavMeshBoundVolume to generate Navmesh.
After having some performance issue on our dynamic navmesh, i wanted to set the runtime generation to DynamicModifierOnly, since we’re updating only navmodifier and seems it benefits of some optimisation.
Unfortunately, after trying multiple time, i did not found any method to effectively generate the navmesh after the PCG part is done.
my last attempt ended on this specific line
// Game world static navmeshes accept only area modifiers updates
if (bGameStaticNavMesh && (!DirtyArea.HasFlag(ENavigationDirtyFlag::DynamicModifier) || DirtyArea.HasFlag(ENavigationDirtyFlag::NavigationBounds)))
{
continue;
}
From FRecastNavMeshGenerator::MarkDirtyTiles(const TArray<FNavigationDirtyArea>& DirtyAreas)
Since all Dirty Areas at this point have their flags set to (All | NavigationBound) 11
I wonder if we miss a <not> here
!DirtyArea.HasFlag(ENavigationDirtyFlag::NavigationBounds)
So either DynamicModifier for navmesh update, or NavigationBounds for navmesh first generation.
Or maybe this is intended, and navmesh should be generated using another method ?
[Attachment Removed]
Steps to Reproduce
Create a scene with some blocks / PCG
Set Navmesh runtime generation to DynamicModifier in ProjectSettings
In Cpp, after blocks / PCG are done loading
- call NavSys->AddDirtyArea (should also work with a NavBound in level)
- call Navsys->Build or RecastNavMesh->RebuildAll
Check that no navmesh has been generated .
[Attachment Removed]
Dynamic Modifiers Only does not generate additional navmesh at runtime. It will generate a navmesh in the editor and then can apply modifiers to the navmesh at runtime. Dynamic navmesh generation is the only mode that will fully create navmesh at runtime. If the issue you were seeing were lots of rebuilds happening while generating with PCG, you can lock the navmesh until PCG has finished, and once it is finished, release the lock and rebuild the navmesh in the dirty area. You can also change the amount of time spent in building navmesh each frame by adjusting values in FNavRegenTimeSliceManager.
-James
[Attachment Removed]
Sorry, my explanation should not be clear enougth, that’s not my point here.
Was around the “Runtime Generation = Dynamic Modifiers Only” settings and PCG
But you’ve answered my question :
- “Dynamic Modifiers Only” can’t be used for PCG
- Forcing navmesh generation while in this mode is not possible and not intended to (was my question)
- This setting can’t be set runtime
I fixed my performance issue by changing some navmesh polygon cost at runtime without rebuilding navmesh.
[Attachment Removed]
You could use Dynamic Modifiers Only and PCG as long as there is a base navmesh in the level that is loaded. You can then have PCG populate the level and use modifiers on the objects created such as Obstacle to markup the navmesh and have pathing avoid the objects.
-James
[Attachment Removed]