Navigation system for Procedural Mesh Component.

I’m trying to generate navigation mesh on a procedurally generated mesh (grid plane) at runtime. I have dynamic navigation mesh generation enabled in project settings and “Can affect Navigation” enabled on the procedural mesh. Navigation mesh is working fine for static and instanced meshes.

Procedural mesh I have receives navigation data only after I actively move its location in editor window (in F8 edit mode), but nothing I’m trying to call from scripts seems to update the navigation mesh.

Here is a list of what I tried:

  • FNavigationSystem::RegisterComponent
  • FNavigationSystem::UpdateComponentData
  • FNavigationSystem::UpdateComponentDataAfterMove
  • FNavigationSystem::OnPostEditActorMove
  • FNavigationSystem::Build
  • UNavigationSystemV1::AddDirtyArea
  • UNavigationSystemV1::RebuildDirtyAreas
  • UNavigationSystemV1::RegisterComponent
  • UNavigationSystemV1::Build
  • UNavigationSystemV1::RebuildAll
  • Locking navigation building in project settings and unlocking at runtime with UNavigationSystemV1::ReleaseInitialBuildingLock

Update: Found this answer. Tested UpdateComponentData(USceneComponent*) in an empty project with a plain procedural mesh component. I generated grid mesh using blueprint and the navigation mesh works. Apparently the problem is that in my main project I create a child of UProceduralMeshComponent with my custom logic for generating the mesh and the UpdateComponentData call doesn’t work with a child even if I cast a child to UProceduralMeshComponent or USceneComponent. I fixed this issue by moving mesh generation code from a child to a separate class and using UProceduralMeshComponent that UE provides without any modifications. Now FNavigationSystem::UpdateComponentData() call on UProceduralMeshComponent works as intended.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.