Search Unity

navmesh agent path calculation throttling when using destination?

Discussion in 'Navigation' started by snacktime, Feb 23, 2019.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Maybe it's just a bug but I'm guessing it's throttling the max number of in progress paths it will calculate. But if so it's a ridiculously low number.

    This happens when setting the agent via destination. State stays in pending for up to minutes at a time with around 500 agents. If I just calculate the path myself and then use SetPath, it's all good agent starts moving immediately.
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Yes, there's a limit on NavMeshQueries per frame, and when you're dealing with 500 agents you will probably be way over that.
    Are you recalculating the path for each agent manually, or are you calculating one path and then set that identical path for each agent?
     
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I calculate for each agent. Guessing at one point they had some reason for throttling. At this point calculating paths is dirt cheap, crowd handling is where all the cpu time is.
     
  4. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    Just increase NavMesh.pathfindingIterationsPerFrame if you think it throttles too early.