Possible bug with StartPath() being called right after OnRouteFinished()


I just spent some time debugging this, and was finally able to find a solution. Am wondering if there is a better way.

It seems that the OnRouteFinished() callback, isn’t a sign that you are free to send the seeker on a new StartPath() right away. I was wondering why it wasn’t working, when I noticed that it was making the call for the next route, even though the seeker hadn’t completely stopped moving.

This made me think to use a coroutine, with a delay, before making the next call, which fixed the issue. Is there a parameter we can pass to StartPath, where it only calls OnRouteFinished(), when we are clear to start the next path? Thanks.


What do you mean with OnRouteFinished? Which specific callback is that? There is nothing in my package referenced using the name OnRouteFinished.

Sorry, sir. I was tired and copy pasted my wrapper function, instead of OnTargetReached()

I think this might be related to the features which allow the seeker to slow down before arriving at destination.


So the OnTargetReached callback will be called when the agent comes within ‘end reached distance’ (which is a parameter set in the AIPath inspector) world units from the end of the path. If you want it to be closer to the point before moving to the next target I would suggest reducing that value.
Is this the issue you are having?