Hello,
I am having a problem with starting a path (I am trying to do flee behaviour) on my RichAI script.
It is most probable that I do not understand how to work with both RichAI and the underlying seeker
My reasoning goes like this:
- I create the flee path
- I start the path calculation on the seeker
- In the callback (once it is calculated), I set the path to the RichAI
- the character will flee, yeeey
Code:
public void Flee(OfficeWorkerAI from) {
Running = true;
_movementScript.maxSpeed = 3f;
_movementScript.canSearch = false;
Vector3 thePointToFleeFrom = from.transform.position;
int theGScoreToStopAt = 100000;
FleePath path = FleePath.Construct (transform.position, thePointToFleeFrom, theGScoreToStopAt);
path.spread = 1000;
Transform exit = GameObject.Find("Exit").transform;
Debug.Assert(exit != null, "exit != null");
path.aim = exit.position;
path.aimStrength = 10000;
Seeker seeker = GetComponent<Seeker>();
seeker.StartPath(path, p => {
TrySetCanMove(true);
_movementScript.SetPath(p);
});
}
However, I keep getting this error, even though I am using the callback so the path should be done.
ArgumentException: You must call the SetPath method with a path that either has been completely calculated or one whose path calculation has not been started at all. It looks like the path calculation for the path you tried to use has been started, but is not yet finished.