- Home /
Question by
SilverWalker · Mar 31 at 11:32 AM ·
navmeshagentnavigation
NavMeshAgent.isStopped == false does not resume movement
Hi everyone!
I need to do simple thing: When something happens my object need to stop moving. So i make NavMeshAgent.isStopped = true. This code is in update method.
NavAgent.isStopped = true;
easyAnimator.SetBooleanTrue("isJumpAttacking");
if (startJumping)
{
NavAgent.isStopped = false;
NavAgent.SetDestination(Vector3.zero);
startJumping = false;
}
After it's stopped it fires animation and wait till flag startJumping is true. After i want to start movement again with another path (Vector.zero is just a sample of such path). This does not work! What does work? This:
NavAgent.isStopped = true;
NavAgent.isStopped = false;
easyAnimator.SetBooleanTrue("isJumpAttacking");
if (startJumping)
{
NavAgent.SetDestination(Vector3.zero);
startJumping = false;
}
I have one question... why? xD
Comment
Answer by Hawaii_Dev · Mar 31 at 01:45 PM
If this is directly in your update function you are always setting NavAgent.isStopped = true. This means that it can never be false at it the next frame updates to true again.
Your answer
![](https://koobas.hobune.stream/wayback/20220613054840im_/https://answers.unity.com/themes/thub/images/avi.jpg)