Hi! I’ve been having a recurrent issue with pathfinding ever since I switched to the Behavior Designer (I hard-coded everything before). Nothing else about the Seeker, graph, or modifier setup has changed – just the fact that I’m controlling the AI using Behavior Designer.
Here is the photo of the situation:
The unit on the left is giving me this warning repeatedly:
Path Failed : Computation Time 0.00 ms Searched Nodes 0
Error: Couldn't find a node close to the end point
Path Number 113 (unique id)
UnityEngine.Debug:LogWarning (object)
AstarPath:LogPathResults (Pathfinding.Path) (at Library/PackageCache/com.arongranberg.astar@4.3.41/Core/AstarPath.cs:837)
AstarPath:<InitializePathProcessor>b__122_1 (Pathfinding.Path) (at Library/PackageCache/com.arongranberg.astar@4.3.41/Core/AstarPath.cs:1299)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at Library/PackageCache/com.arongranberg.astar@4.3.41/Core/Misc/PathProcessor.cs:512)
Pathfinding.PathProcessor/<>c__DisplayClass26_0:<.ctor>b__0 () (at Library/PackageCache/com.arongranberg.astar@4.3.41/Core/Misc/PathProcessor.cs:147)
System.Threading.ThreadHelper:ThreadStart ()
You can see its destination in the middle of the screenshot – on a valid graph. It is trying to approach the character on the right, who is moving away normally on that same graph, with a valid path. But the character on the left cannot get a valid path, spamming the error.
If I wait for a while and let it retry, it’ll recover and find a path (when the destination updates). If I grab it in the Scene view and move it somewhere, it won’t have any effect.
This bug happens a lot, and in a variety of situations and level layouts, and I’m not sure what I am doing wrong. I verify that the destination is on the graph, and use this very simple code to set destination (actually, the Behavior Designer used it in their example node and I just copied it into mine):
readonly NNConstraint constraint = new NNConstraint
{
constrainDistance = true,
constrainWalkability = true,
walkable = true
};
NNInfo info = AstarPath.active.GetNearest(centralPoint.position, constraint);
closestValidPoint = (Vector3)info.node.position;
agent.canSearch = true;
agent.destination = target;
…where “centralPoint” is an AI Grid point that was returned by my Environment Query (both custom systems I wrote). As you can see, the point is, in fact valid, as it shows up in the debug on the screenshot above (or does it mean that, actually?)
I am approaching my wit’s end with this bug. Please help!