This seems to work, but unfortunately it appears it is not the only cause of my issues.
http://i.imgur.com/iKqaSEq.jpg
You can see in this image that the nodes with no connections have been made unwalkable, but what I am failing to understand now is two things:
1.) why did they have no connections? this is a nearly flat surface; by all rights these should have had connections.
2.) if you look closely, you will see a green point, and a black wire cylinder near the agent that triggered the exception (of not being able to find a path. This is the code I run in that error to help diagnose the issue:
if (path.error) {
Debug.LogError(this.name + ": " + path.errorLog);
DebugExtension.DebugPoint(transform.position, Color.green, 0.25f, float.MaxValue, false);
pathfindingState = PathfindingState.CalculatedFail;
// when there is an error, it is usually either because we are stuck, or because
// there is an issue with the end point. Let's just find the closest node and
// move to it.
NNConstraint nnc = new NNConstraint();
nnc.constrainWalkability = true;
NNInfo nni = AstarPath.active.GetNearest(transform.position, nnc);
controller.Teleport(nni.clampedPosition);
int connectionCount = 0;
nni.node.GetConnections((GraphNode node) => {
connectionCount++;
});
if (connectionCount < 1) {
Debug.LogError("Found node has " + connectionCount + " connections");
}
DebugExtension.DebugCylinder(nni.clampedPosition, nni.clampedPosition + Vector3.up, Color.black, 0.0825f, float.MaxValue, false);
controller.Move(transform.position.NormalTo(nni.clampedPosition));
yield break;
}
(Sorry, that did not copy very well). Any ideas why this is happening? to give further context, the agent moves up to a tree, “harvests” it, and then a rescan of the graph is made to fill in the area the tree once stood in, in addition to a buffer area around it to ensure we capture everything. the agent is then instructed to go elsewhere. It mostly works, but agents eventually get stuck like this.