Hi there,
If I set my navmesh to “Dynamic” or “Dynamic Modifiers Only” and then put a pathfind in the event tick of a blueprint I will see an incremental performance decrease over time until it suddenly shoots up to full framerate again. Which I guess is when garbage collection occurs.
Steps to reproduce:
- Blank project.
- Place a standard “Floor_400x400” static mesh at -500,-500,0 and scale it to 5,5,2
- Add a NavMeshBoundsVolume that covers the floor, and check that a RecastNavMesh is created properly.
- Set the RecastNavMesh runtime generation to “Dynamic” or “Dynamic Modifiers Only”.
- Open the SM_Chair asset and under Navigation, set its area class to NavArea_Obstacle and check the “Is Dynamic Obstacle” box.
- Create an Actor blueprint and add the newly modified SM_Chair asset to it.
- Add a “AddLocalRotation” node in the Event tick of the blueprint with delta rotation 0,0,1 and hook it up to the SM_Chair static mesh component. This is to force the navmesh to be recalculated every frame.
- Add a “FindPathToLocationSynchronously” node in the Event tick with path start set to 1300,1300,1 and path end -350,-350,1.
- Place the actor on the floor in the level so that it affects the navmesh.
- Hit run and use the console to show the navmesh and show the FPS. Make sure the navmesh is constantly updating and see how the framerate gradually goes down over time.
Is there any way to avoid this issue? A garbage collect seems to prevent the framerate from gradually decreasing, but it also prevents the game from running at any desired framerate. Is there a more selective garbage collect I can do, or perhaps another approach altogether?