Looking to cancel current path, what is best way?

I have animals that randomly move around using the random path function. I want them to check their surroundings and if a predator shows up, flee. I know how to check surroundings and such but how do I cancel whatever AIPath is doing at the moment and tell it to Flee? Looking for the best way to force AIPath to clear what its up to.

Make sense?

Hi

You can disable ai.canSearch which will make sure it does not try to recalculate its path again, and then you can make it use a path that you give it using ai.SetPath.
Something like this:

RandomPath t = RandomPath.Construct (transform.position, 500000);
t.spread = 5000;
ai.SetPath(t);

I recommend that you do not explicitly try to cancel whatever it is doing because then it will do nothing in the few frames that the path is being calculated.