Multiple Areas - NPC cant find nodes

Hi everyone.

I’ve created a Level that contains several “Patches” (so called “Areas” i think) of meshes that are combined into one big navmesh.

Now, my AI does have a “Chase” behaviour. basically, when it sees the player, it chases the player. Now, it seems as if when the AI tries to generate a path towards a player that passed over multiple of those “Areas”, the Pathfinding drops this Error: “Couldn’t find a close node to the end point”.

That makes totally sense to me - i guess that the seeker tries to generate a path from one Area to another (which of course is not possible), and therefore generates this error. I’ve read in other threads that a possible solution to make an NPC stick to his area (and only use all avaiable nodes on the area he is on) is to use NNConstraints, yet i failed to implement them.

Could anybody shine some light on this mysterious NNConstraints and how to use them properly? :slight_smile:
Or maybe name a different approach to solve my problem and make an NPC stick and only generate paths in one area?

Thanks a lot upfront!



Here is a Code snippet of my current path-generation for the chase behaviour (at the moment not using the generated nnInfo.pos as target, because it dropped null ref. errors):

    GraphNode node =, NNConstraint.Default).node;
    uint areaID = node.Area;
    //Then you want to configure the NNConstraint to only return nodes which can be reached from the start node:
    NNConstraint nn = new NNConstraint();
    nn.constrainArea = true;
    nn.area = (int)areaID;

    NNInfo info = as Transform).position, nn);
    m_generatePath = false;
    pathSeeker.StartPath(transform.position, (target.GetValue() as Transform).position, OnPathComplete);

    m_currentRepathCounter = 0;


I suspect that the GetNearest search is being limited by the maximum search distance.
Try increasing the A* Inspector -> Settings -> Max Nearest Node Distance value.

Hi aron,

Thanks for the reply. The Problem is, with the code that i posted above, the “NNinfo info” always returns null. When i then try to create a path using the gathered info via “pathSeeker.StartPath(transform.position, info.clampedPosition, OnPathComplete);” the seeker tries to create a path to the scene-origin (0,0,0).

As if he couldnt find the specified node. Perhaps there is a problem in the Area-ID conversion from uint to int? (as the Graphnode node only returns a uInt, but the NNConstraint only accepts an int)

Cheers and thanks upfront!


When searching for a nearest node, it will not go on and search forever, it will stop unless it finds a node within the Max Nearest Node Distance value.

Note that when just using a regular path search, it will do pretty much the same thing as you do, that is: search for the closest node to the target that it can actually reach (i.e is in the same area).

ahh okay… with that info now the error is also easy to reproduce… :slight_smile:
in my current case the error occurs not on areas that overlap, but when the chased-object gets out of the “maxNearest” distance.
so basically, when i get the error that the NPC cant find the path, it makes no sense repeating the search in the “OnPathComplete” callback, since nothing will change, right?

so i guess my options are: increase “maxNearest” even further (performance hit?), or abort the path-search?

thanks for the quick reply!

actually i just figured out a third option… generate a new point that is in the maxNearest range, between the NPC and the target… gonna try this one, i guess?