Checking path cancelation is complete if it happens on another frame?

I’m using SetPath(null) to cancel the path when the Agent hits a trigger so I can rotate them to face a direction. When I wait and trigger the turn animation manually using input the animation is played successfully, however when the script plays the animation the body position stays facing forward whilst that turn animation is playing (resulting in legs moving but the upper body not following).

Can I check something when cancelling a path that shows the cancellation process is completed and all other systems are up to date, so they won’t effect movement while the agents turning on the spot?


Cancelling the path happens immediately. However, maybe the character later recalculated its path?
If you want to prevent the agent from recalculating its path automatically you can set ai.canSearch = false.

Interesting, it isn’t the repathing, still getting the same issue even with canSearch: false and autoRepath.mode: Never. Maybe the way my paths are generated, or maybe something to do with MecanimBridge? Looks like the path still exists as a gizmo even though destination/ remaining distance are infinity.


Note that even if the agent has no path, it may still try to control the transform’s rotation. If you want to take control over the agent’s rotation yourself, you can set ai.updateRotation = false.

1 Like