Issue with one-way roads and finding the nearest node

Hi there!

I’ve built my own implementation of a point graph to allow for one-way connections in my graph.

Image link, sorry, I can’t post more than 1 image.

The lower path (green) contains two nodes forming a one-way connection, the upper one is basically the same, but with it’s direction reversed. To be able to interconnect paths, I’ve combined all created paths into one Pathfindingproject Graph. Both paths in this constellation do not connect to each other, so essentially, an agent spawned on one path should not be able to pathfind to the other path.

Now, if I spawn an agent on the upper path, I want to check whether I can pathfind to the exit node (in the picture) of the green path. I’m doing this by simply calling the pathfinder directly using StartPath() and WaitForPath(). Now, for some reason (remember, both paths do not connect to each other), the call to StartPath() returns the following path:

As you can see, originalStartPoint (the upper) and originalEndPoint (the lower) are correct, but for some reason, startPoint and endPoint are essentially the same. If I open up startNode and endNode, I can see that they are both the same (starting) node. But even though it couldn’t reach the requested end point (which it obviously shouldn’t with both paths lacking a connection to each other), p.error is always false, telling me that it found a valid path.

Could you help me understanding what is going on here? I’m thinking it must have something to do with the GetNearest() method of NavGraph, but I left that at it’s default implementation.

Best Regards


It will try to navigate to the closest node (within some distance D) it can reach to the target. If you want to decrease this distance D then you can modify the A* Inspector -> Settings -> Max Nearest Node Distance value.


Thanks a lot, lowering the Max Nearest Node distance helped!


Hi its almost 4 yrs old since this thread was opened
may I ask how did ya implement one-way node pathfinding I need it for my cars ai to follow the appropriate direction