How to access Walkable?

I’m trying to determine if a location a mouse was clicked is walkable or not. I see that there is a Walkable bool on GraphNode. I’m using a GridGraph. How do I get access to the GraphNode on the Pathfinding object? I couldn’t find any examples.

E.g., I don’t want the player to be able to click and move to the green ball:

image

Google AI powered serach provided a path to a solution. I don’t know if this is best or proper, but it does work:

// Where targetPos = coord of mouse click
if (!AstarPath.active.GetNearest(targetPos).node.Walkable) {
    Debug.Log("Don't tread on me.");
    return;
}

That AI powered code snippet should work perfectly well :slight_smile:

You can read more about nodes here: Using nodes - A* Pathfinding Project