I am using characters to move using a nav mesh bound when standing still a nav modifier gets added.
When the character starts moving the nav modifier gets removed.
I used this way because dynamic obstacle field caused to much fps stutter.
The nav mesh bound is generated with 10 cell size and 10 cell height and the tile size 800.
The cell size and height are required for some functionality in the game.
Now the problem is after a few times moving the character and adding and removing the nav mesh modifier, the nav mesh modifier adding and removing are causing large fps spikes.
For instance from 60 fps to 5 fps for an instant. This is every time the character start moving (remove modifier) and stops moving (adding modifier)
I know this is late but if anyone comes across this and might find it helpfull.
I found what the problem was in my case.
I am looping a lot through the node “Find Path to Location Synchronously” to calculate where a character can move to.
I do this calculation everytime the character stops moving.
I found out that the node “Find Path to Location Synchronously” can be invalidated through adding/removing nav mesh modifiers within a certain time of using the node.
Every time the path is invalidated it recalculates the path.
As an example when I move a character 5 times within a minute then the calculation for 10000 paths per move gets recalculated.
In the end this ends up with 50000 paths which need to be recalculated.
This caused the large fps spikes.
I found a solution to prevent the recalculation of the paths when they get invalidated.
Connect the return value of “Find Path to Location Synchronously” with the node “Enable Recalculation on Invalidation” and put the parameter “Do Recalculation” to “No”.