Navmeshagents stopping for no reason.

Hey! So I was testing some things with navmeshs and when I had 52 agents at once all calling Agent.SetDestination(PlayerTransform.position) in the update functon, the agents would all stop for a short time and then start up again, happening once every now and then. Obviously it’s a bad idea to do that many calls but I was wondering if there is a way to fix this as it has happened with other, smaller amounts of agents making the calls a lot less often (the stopping just happens less often and doesn’t last as long).

I’ve had another project in the past that had 500 agents moving at once with SetDestination() in Update() and it didn’t have any problems. I was wondering what the reasoning is. The navmesh I’m using atm is more complex than the one that had 500 agents but not by quite a bit but it’s still really simple.

I was mainly wondering if this is a bug, if there is a way to fix it, or does navmesh just have it’s limits even if I have a lot more power on my PC to run more agents and what are those limits so I can plan ahead. Any help is appreciated.

On your NavMeshAgent, uncheck autobraking. This will not allow them to stop when recalculating the path.

I stole this from another post but it worked for me so reposting here.

The SetDestination() function works over a few frames to spread the load of the calculations.

You could try a few things:

Try setting a queue for the agents and update them in separate frames.

Make the mesh more simple, from the settings or by adding more basic invisible geometry instead of the more complicated visible geometry.

I recently had a Problem and fixed it by Moving my Spawn points closer too the navmesh for some reason if you don’t spawn them close to the navmesh they will auto correct too it but have strange stuttering when they move.