Constant Path Callback


I’m attempting to use the ConstantPath class to get all nodes within movement range of the player.

I’m using a seeker to to calculate the path in a LayeredGridGraph setup, however I’m receiving an error when the callback triggers.

The code I’m using is taken from the documentation.
Documentation (

Error Received:
Exception: This function only handles ABPaths, do not use special path types. AIPath.cs:289)


   _seeker.StartPath(ConstantPath.Construct(transform.position, 7), OnPathCalculated);

    private void OnPathCalculated(Path path)

The method OnPathComplete, it is indeed trying to cast newPath as an ABPath (AIPath.cs:287).
How can I get a callback from a ConstantPath? Or is there an alternative way, maybe without using the seeker? I am unable to cast a ConstantPath to a ABPath.

Looking around the forum, using the callback appears to be the correct way to get the nodes once the path is calculated.

Any insight would be appreciated.


Probably because the AIPath listens to completed paths from the seeker.
I’d calculate the ConstantPath separately without using the Seeker to avoid sending the completed path to the ai script.

var path = ConstantPath.Construct(transform.position, 7000, MyOnPathComplete);


You may also be interested in Documentation which can be easier to use in some scenarios.

Ah perfect, thankyou.