I’m trying to figure out how to call function X when FleePath is done, I thought the callback in StartPath
would be called when path is done, but seems its called when I call StartPath
:
public void Enter()
{
agent.canSearch = false;
var pointToAvoid = enemy;
var path = FleePath.Construct(agent.position, pointToAvoid, 1000 * 250);
path.aimStrength = 1;
path.spread = 2000;
Seeker seeker = unit.GetComponent<Seeker>();
seeker.StartPath(path, PathCompleted);
}
public void PathCompleted(Path path)
{
Debug.Log("Path end reached");
}
I am calling this from one of my states in my state machine, how can I check when unit reached end of flee path?