Argument Exception when Starting a Path

I’ve been working with the system for a bit now and what I wanted to do was find all nodes an agent could reach within X nodes of themselves. (~10 Nodes for my Purposes)

I want to do this to get all the places the agent could go next so I can pass this list through some scorer algorithms on a behaviour tree to select the best location to go. But this works fine.

The issue being trying to find all the nodes. I’ve done this by finding the nearest node to the agent’s current position and from there creating a ConstantPath to find all available nodes within ~10 nodes (Duplicating nodes does not matter).

        GraphNode node =, NNConstraint.Default).node;
        cPath = ConstantPath.Construct((Vector3)node.position, 10000, null);
        seeker = GetComponent<Seeker>();

This part works fine and the Agent is being moved as expected with no issues. What is cause for concern is that it throws a system exception.

Exception: This function only handles ABPaths, do not use special path types - 
Pathfinding.AIPath.OnPathComplete (Pathfinding.Path newPath) (at Assets/AstarPathfindingProject/Core/AI/AIPath.cs:282)
Pathfinding.Seeker.OnPathComplete (Pathfinding.Path p, System.Boolean runModifiers, System.Boolean sendCallbacks) (at Assets/AstarPathfindingProject/Core/AI/Seeker.cs:326)
Pathfinding.Seeker.OnPathComplete (Pathfinding.Path path) (at Assets/AstarPathfindingProject/Core/AI/Seeker.cs:293)
Pathfinding.Path.ReturnPath () (at Assets/AstarPathfindingProject/Core/Path.cs:775)
Pathfinding.Path.Pathfinding.IPathInternals.ReturnPath () (at Assets/AstarPathfindingProject/Core/Path.cs:833)
Pathfinding.PathReturnQueue.ReturnPaths (System.Boolean timeSlice) (at Assets/AstarPathfindingProject/Core/Misc/PathReturnQueue.cs:54)
AstarPath.Update () (at Assets/AstarPathfindingProject/Core/AstarPath.cs:871)

It does this on this line of OnPathComplete in AIPath.cs

protected override void OnPathComplete (Path newPath) {
			ABPath p = newPath as ABPath;

			if (p == null) throw new System.Exception("This function only handles ABPaths, do not use special path types - ");

It does this because I’m using a ConstantPath. I was wondering if anyone knew how to do what I’m attempting to do without it throwing exceptions into the console. The behaviour works and there are no errors in that regard but in general I feel it’s best to solve errors thrown to the console to prevent it crowding out important messages throughtout development.

So is there a way to silence the exception? Or a function to start the Path using the ConstantPath that won’t trigger the exception? Sorry I’ve been workinig at it for a while and I’m not having luck.


The AIPath script listens for completed paths on the Seeker and will try to follow them. This is what causes the issue, because it cannot follow a ConstantPath.

You can use instead which doesn’t involve the Seeker.

However, if you want exactly N nodes and not “within a cost of N” (which is what the ConstantPath uses) then you can use the BFS function. See PathUtilities - A* Pathfinding Project

Hello, thanks for the quick reply. Sorry if this is a stupid question.
I would like to use ConstantPath for the time being but I’ll do some experiements on the other options you mentioned as I go along. Still I was looking to implement using “”, changing the script where I begin searching a bit.

        OnPathDelegate temp1 = DrawPath;
        GraphNode node =, NNConstraint.Default).node;
        cPath = ConstantPath.Construct((Vector3)node.position, 10000, DrawPath);;

However I now get an error I haven’t seen before and I’m not getting clear answers from my searches on how to fix it.

Assets\Scripts\DevelopingScripts\ExperimentScript\ExperimentalMovement.cs(27,9): error CS0176: Member 'AstarPath.StartPath(Path, bool)' cannot be accessed with an instance reference; qualify it with a type name instead

I’ve attempted a few other things I’ve found online in relation to names but nothing has worked. I’m a bit confused because I was able to access functions from the active grid in the same script. Would appreciate any help and sorry for any bother.

Ah, sorry. That should have been