Callback if path is blocked after calculating


I have a question about checking if a path can be reached / is blocked. So the agent is on it’s way, but halfway there the path is blocked.

I already use ‘PathUtilities.IsPathPossible’ to check if an agent can reach its path. However, if the path is blocked after the path is calculated, the agent moves to the closets possible point.

I have two questions:

  • Is it possible to make the agent just stop when it can’t reach its path (and not go to the closest point)?
  • Second, is there a way to know that the path is not accessible anymore after is set out? Or do I need to check it myself with an interval or something?



You’ll need to check this regularly yourself. It is not monitored by the script. For example:

void Update () {
    ai.isStopped = !PathUtilities.IsPathPossible(, NNConstraint.None).node,, NNConstraint.None));

(though running it every update loop might be overkill)

All clear, thanks for the reply :slight_smile: