Prevent UpdateTargetPosition() in TargetMover

I am making a 2D game and I have been trying to find the way to prevent UpdateTargetPosition from being called when certain objects are clicked. To clarify, I have colliders set up so that the Player (the only thing using pathfinding) can’t walk into designated areas, but the pathfinding script finds the closest point to where I clicked and sets the target there. This causes the Player to walk toward an object even if it can’t walk all the way to the point that was clicked, I would like to prevent this so that if the Player cannot walk to the point that was clicked the path will not be updated at all.

Thanks for your help.

Hi

You can check if a path is possible at all.
See How do I know if there is no path possible to arrive at target?
or Check if ai has no complete path