Can't get IsPathPossible() to work

In my pathfinding script (javascript) I have a function in which I want to check if a point can be reached. I want to use IsPathPossible(), but Unity sais:

“No appropriate version of ‘Pathfinding.PathUtilities.IsPathPossible’ for the argument list ‘(Pathfinding.NNInfo, Pathfinding.NNInfo)’ was found.”

The function is in the same file as other pathfinding function which works fine. How do I use the PathUtilities?
Must I include some other scripts other than pathfinder?

// SCRIPT
import Pathfinding;
.
.
.
.
function isPatchClear(newTarget:GameObject) {
if (!Pathfinding.PathUtilities.IsPathPossible (AstarPath.active.GetNearest(transform.position, NNConstraint.Default), AstarPath.active.GetNearest(newTarget.transform.position, NNConstraint.Default))) {
Debug.Log (“Oh noes, there is no path between those nodes!”);
}
}

Hi

It does not take an NNInfo, it takes a GraphNode. It might be a bit confusing since NNInfo can be explicitly cast to a GraphNode.
`
GraphNode a = AstarPath.active.GetNearest(transform.position, NNConstraint.Default).node;
GraphNode b = AstarPath.active.GetNearest(newTarget.transform.position, NNConstraint.Default).node;

if (!Pathfinding.PathUtilities.IsPathPossible (a,b)) {

}`

1 Like

Thanks for the fast reply. I got it to work now :slight_smile: