I’ve been looking through the forums for code to stop the units current path, but none of it seems too be working in the OnTargetReached method.
Here’s what I’ve added to the method.
public virtual void OnTargetReached () {
// The end of the path has been reached.
// If you want custom logic for when the AI has reached it's destination
// add it here.
// You can also create a new script which inherits from this one
// and override the function in that script
seeker.CancelCurrentPathRequest();
seeker.GetCurrentPath().Error();
path = null;
}
How else should I be attempting to stop repathing over and over once the target has been reached?
Edit: I’ve already logged the event to make sure it’s definitely calling OnTargetReached.