Path failed: Searched whole area but could not find target


I just started recently to use the free version of A* Pathfinder project, and it’s really awesome!! but i’ve a found aproblem that i can’t solve by myself.

I’ve 1 Grid Graph created on my map, the obstacles work fine, and the grid works nicely. I’ve setup an area with a tag with the Graph Update Scene Script; and the problem comes here.

I’ve an AI with the Seeker configured so it can’t pass through the tagged area, and it happens that when i place the target of this AI inside the tagged area, the console says: “Path Failed : Computation Time 2.00 ms Searched Nodes 48 Error: Searched whole area but could not find target”

Question: It’s there a way for the AI to approach the target as much as possible without entering the tagged area???

Here there are some pictures of my map:

Here you can see the grid graph, the capsule it’s the AI, the red line it’s the tasgged area with the GUS Script and the 3 arrows are the gameobject that represents the target i want the AI to approach. I know the AI can’t go to that point (because it’s in a tagged area), but it’s there a way so it can approach to the closest node of the target??

Here’s the code i use to see if it can reach the target:

                // With this i select a random position as a target
                Vector3 randomPosition = BarManager.instance.tavernCenter + Random.insideUnitSphere * 5;

                randomPosition = new Vector3(randomPosition.x, 0, randomPosition.z);
                Debug.Log("randomposition: " + randomPosition);

                //Find the node the character is standing on
                GraphNode node =, NNConstraint.Default).node;

                // Configure an NNConstraint
                // which makes sure the resulting node can be reached from your character
                NNConstraint constraint = NNConstraint.Default;
                constraint.constrainTags = true;
                constraint.constrainArea = true;
                //constraint.constrainWalkability = true;
                constraint.tags = ~(1 << 2);
                constraint.area = (int)node.Area;
                NNInfo closestOnGraph =, constraint);
                Vector3 closestPoint = closestOnGraph.clampedPosition;
                GraphNode closestNode = closestOnGraph.node;

                Debug.Log("Node position: " + BarManager.instance.idleHelper.transform.position);
                BarManager.instance.idleHelper.transform.position = (Vector3)closestNode.position;
       = BarManager.instance.idleHelper.transform;

GUS setup , i’ve call the tag Bartenders, and it’s the second Tag.

Seeker setup of the AI



You can enable ABPath.calculatePartial on your path object to make it do what you want.

The reason that this is not enabled by default is because it is easy to make it fall off a performance cliff. When the path to the target is only blocked by tags, the path cannot know the closest node to the target when the path is started, so it will have to exhaustively search all nodes it can find, which is not particularly fast, especially for large graphs (it can easily be 2 magnitudes slower than normal path calls). However in your case the graph looks pretty small, so I don’t think that should be a big problem.

1 Like

I’ve tried it uncommenting these lines in AIPath.cs

But, the problem i have now it’s that the seeker thinks that it has arrived to the destiny after moving just a little bit, so it’s completly useless :frowning:.

Any ideas on why it’s happening this??

Thanks for the quick answer! :smiley:


If you are referring to the OnPathComplete callback, that callback is called when the path calculation has completed, not when the AIPath script has reached the end of the path.


Well, the code i mentioned was in the SearchPath function, i’ve not touched anything on OnPathjComplete, and i use OnTargetReached to trigger functions at the destination, so it’s this right??

Thanks again! ^^

EDIT: ok, it looks that there’s a typo in the code, changing targetPoint for targetPosition in

ABPath p = ABPath.Construct(GetFeetPosition(), targetPoint, null);

in the SearchPath() in the AIPath.cs makes it work!! but still, if there’sa point that i can’t reack, the AI stays still :frowning:


Yes, that was a typo. Thanks for finding it.

Also. For the partial path feature. As noted in the documentation, it is currently an experimental feature and it hasn’t been tested much. For your use case I think you will need to make a small change. In the ABPath script, find these lines (you can find them in two places)

CompleteState = PathCompleteState.Partial;

and change both of those instances to

CompleteState = PathCompleteState.Partial;
endNode = node;
endPoint = (Vector3)endNode.position;

Maybe something else will be needed too, I am not sure.

1 Like

Thanks for al the help! :smiley: but i find a problem, the asociation:

endNode = node;

gives me an error, ususally, endNode = endNNInfo.node; but in those cases, i don’t have the

NNInfo endNNInfo =, nnConstraint, endHint);

declared so i can use node as a varaible… any suggestions to solve it?

Oh, try endNode = node.node;

there’s no variable called node, so node.node gives m an error too:

The name 'node' does not exist in the current context 


Ah, I see. Hm… I am not sure where I got the ‘node’ variable name from… I should have written ‘partialBestTarget.node’

1 Like

yes! now it works! Thank you very much! once i test more the pathfinding, i’ll post the results ^^