Support Forum

How To Get Path and Destination Event When Finished

Hi there i want to get event to finished path or destination both of them would be great!
_aiPath.SetPath(path);

im trying to listening path like this;

_seeker.pathCallback += OnPathCompleted;

but onpathcompleted method never invoked, not even once.
If you know the solution please help!.

And i have more than one path followers so it event should be different from each other.

Hi

The seeker.pathCallback should be invoked whenever that Seeker has finished calculating a path. Are you sure it’s not being called? Are you sure the same Seeker is the one calculating the path?

Ahh… i dont want the path calculate finish event, i want event when player finished walking

You guys can make this with action maybe? on Setpath or something.

Hi

There’s no event for this, but you can use the ai.reachedDestination property. In this case you will also want to set the ai.destination property to the end point of the path, if you are setting the path manually.

I added an action reference on SetPath method in AIBase. After that i added this method;
For my case _aiPath.reachedEndOfPath not working properly. When the OnCompleted(); method invoked my action that i sended in invokes by method too.

IEnumerator ReachedPathController()
{
     while (_aiPath.remainingDistance > _endNodeDistance)
     {
            yield return null;
     }
    OnPathCompleted();
}