Skip to content

Instantly share code, notes, and snippets.

@DataGreed
Last active August 21, 2023 17:59
Show Gist options
  • Select an option

  • Save DataGreed/df0c008be1f9269d5160af413e939843 to your computer and use it in GitHub Desktop.

Select an option

Save DataGreed/df0c008be1f9269d5160af413e939843 to your computer and use it in GitHub Desktop.
Checks that NavMeshAgent reached destination or gave up trying
public bool ReachedDestinationOrGaveUp()
{
if (!_navMeshAgent.pathPending)
{
if (_navMeshAgent.remainingDistance <= _navMeshAgent.stoppingDistance)
{
if (!_navMeshAgent.hasPath || _navMeshAgent.velocity.sqrMagnitude == 0f)
{
return true;
}
}
}
return false;
}
@behdadsoft

Copy link
Copy Markdown

Thanks.

@Demetree9

Copy link
Copy Markdown

You guys are awesome! Thanks for the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment