Available Nodes around seeker

I create GridGraph and my enemy perfect work for find path to my targetb.I Want to do so.When the enemy has no path to the target, to make it just went on the free nodes. How to get free nodes about enemy?

You can get the closest walkable node by
Node node = AstarPath.active.GetNearest (transform.position, NNConstraint.Default).node; Vector3 pos = node.position;
This is assuming the A* Inspector -> Settings -> Max Nearest Node Distance is set high enough so that there are actually nodes inside that range, otherwise the node variable will be null.
You can make it ignore distance checks for this particular query.
NNConstraint nnconstraint = NNConstraint.Default; nnconstraint.constrainDistance = false; Node node = AstarPath.active.GetNearest (transform.position, NNConstraint.Default).node; Vector3 pos = node.position;

Image Hosted by pixs.ru
I want get most farthest node. How to make it?

PathUtilities.GetReachableNodes(AstarPath.active.GetNearest(transform.position).node,-1).ToArray(); - this is what I need

Ah, now I understand.
Then you might also be interested in http://arongranberg.com/astar/docs/class_pathfinding_1_1_flee_path.php

Thx. May be useful :wink: