IsPathPossible null error

Sometimes I get null error and the editor point to isPathPossible,
I can see _attacker on scene, so it is not null, so can node be null?

  if (!TileIsEmpty(checkPoint) ||  !Pathfinding.PathUtilities.IsPathPossible(AStar.GetNearest(_attacker.position, Pathfinding.NNConstraint.Default).node, AStar.GetNearest(checkPoint, Pathfinding.NNConstraint.Default).node))
                robotMovePoints.RemoveAt(i);

public static bool IsPathPossible (GraphNode node1, GraphNode node2) {
			return node1.Walkable && node2.Walkable && node1.Area == node2.Area;
		}

Hi

Yes, the node can be null if it is so far away from any valid node that the search cannot find it.
You can adjust the threshold for when it returns null by changing the A* Inspector -> Settings -> Max Nearest Node Distance.

1 Like