|
A* Pathfinding Project
3.0.9
The A* Pathfinding Project for Unity
|
When upgrading from 2.9x to 3.0 there are a few things you need to do to make it work.
seeker.StartPath (fromPosition,targetPosition);
seeker.StartPath (fromPosition,targetPosition, OnPathComplete);
//The name of the function can be anything, but it must always have the same parameters (Path) the name of the parameter (in this case p) can vary though public void OnPathComplete (Path p) { //Check if the path succeeded if (!p.error) { //Path succeeded //The Vector3 path can be got from p.vectorPath (Vector3[]) } else { //Path did not succeed //Error info can be got from p.errorLog (string) } //Worth to note here is that you should never call the Seeker again during the same frame unless you really know what you are doing //Since if the path fails, it often returns to the function the same frame which would then call another path call which would be returned the same frame and it would cause an infinite loop which would crash Unity. And in any case you rarely need updates of the path several times per frame }