1. Unity 5.6 is now released.
    Dismiss Notice
  2. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  3. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  6. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice

Calling NavMeshAgent.SetDestination in Update() stops stoppingDistance working?

Discussion in 'Scripting' started by yezzer, Apr 28, 2012.

  1. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    125
    Simple example:
    Works correctly:
    - User clicks, agent.SetDestination(somePosition) is called.
    - Agent navigates to destination, and stoppingDistance is used.

    Does not work correctly:
    - on Update(), agent.SetDestination(somePosition) is called.
    - Agent navigates to destination, stoppingDistance is disregarded.

    Is this in fact the correct behaviour, or should I file a bug report? If it's the correct behaviour, I think it should be noted in the docs.

    It's sort of mentioned here, and AngryAnt responds with:

    FWIW, I'll do some variation of this. I was aware what I was doing was inefficient, but intended to deal with that later.