How to stop seeker from updating the path?

I just cant find any method for this simple thing, but i have a “direct follow player” condition in AI that starts to follow character when in visual range. I use pathfinding to get to visual range.

But how can i stop the seeker from updating path? When direct follow kicks in, path keeps on updating and eats up CPU because end of path is not reached (because direct follow takes AI to different direction).

You might get away with calling Seeker’s “ReleaseClaimedPath” method and then just disabling(seeker.enabled properly)/destroying the component.

Thanks, tried that but it seems messy because i have to destroy path-modifiers first, then seeker and soon initialize them back to resume pathfinding. Does feel a bit a waste of resources.

Hi

If you use one of the built-in movement scripts they have a property called ‘canSearch’. If you set that to false they will no longer search for paths. A path may be in the middle of calculation right now so you might want to cancel that too:

// In 4.1+ (or possibly 4.0+ I can't remember)
seeker.CancelCurrentPathRequest();

// In earlier versions
seeker.GetCurrentPath().Error();

You can also set the ‘canMove’ property to false if you want them to stop moving completely.