A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
Upgrade Guide

When upgrading from 2.9x to 3.0 there are a few things you need to do to make it work.

  • Backup your project is always a good idea since 3.0 will not be able to read settings from 2.x
  • Remove the A* scripts in the Assets/Editor folder
  • Remove the Assets/Editor Default Resources folder
  • Remove the Assets/Pathfinding folder
  • Import the 3.0 Unity Package, DO NOT copy the files from another project directly since GUISkins and other assets might get corrupted then
  • All GameObjects which had the Seeker or the AstarPath component attached to them will now show up as Missing Script. You will need to reattach the components to the GameObjects
  • The syntax for path calls has changed a bit
    2.9x syntax:
    seeker.StartPath (fromPosition,targetPosition);
    3.x syntax:
    seeker.StartPath (fromPosition,targetPosition, OnPathComplete);
    In 2.9x the Seeker sent completed paths using SendMessage as a Vector3 array
    3.0 will send a callback using a delegate to a specified function, doesn't matter if the path succeeded or not, it will always call that function except in the case where the path was canceled by a new path call to the same Seeker before the path had time to complete
    //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
    }
    More info about the seeker's path calls can be found on the Get Started With the A* Pathfinding Project page
  • The syntax for graph updating has changed a bit, see Graph Updates during Runtime