Unity Issue Tracker - No way to get the remaining distance the frame a new destination isSet
Closed
UUM-47274
No way to get the remaining distance the frame a new destination isSet
Unity: AI Navigation Core
As Designed
2023.2.X
There is a one or more frame delay in SetDestination, and this is by design.
https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent.SetDestination.html
https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent-destination.html
Checking agent.remainingDistance <= agent.stoppingDistance; returns false if you have set the destination that frame as remainingDistance does not update until a frame later. This caused issues when debugging my code and triggered actions sooner than I would have expected. Would be nice for a function like: UpdateNavmeshDestination() to avoid this.
Prioritise and Follow this issue
Have a workaround or additional info about this issue?