godot navigationagent2d pathfinding stutters with 60 enemies
Godot 4.0.4 tower defense. I have up to 60 enemies each with a NavigationAgent2D following a path to the end. When a tower is placed the navmesh is rebuilt and all 60 call get_next_path_position() in the same frame, causing a visible hitch (about 50ms in profiler). Map is a TileMap with navigation layers baked. Two questions: should I stagger the path recalculation instead of all at once, and is there a built-in way to do that? Also the enemies sometimes cut corners through walls that aren't there - probably my navigation layer regions. Any pointers appreciated, I'm mostly self-taught on this.
4 replies