How to exactly use IsPathPossible?

So the idea is kinda simple.

I am using AILerp to move squares around. The “1” square goes into another “1” to create a “2” and so on. I have no problems when there is a reachable square. The problem appears when there is no path between squares, like I showed in the picture above.
The selected square is at x:-2.2 y:1.1 and the “destination” one is at x:1.1 y:-2.2.
I tried to use this link:, but my problem is that I dont understand how to tell it specifically which is node1 and which is node2. Does it have something to do with GetNearest?


Yes, you use GetNearest to find the closest node to a point in world space and then IsPathPossible to see if there is a valid path between those two points. Just like in the code example.

You can also use, z) to get a node at a particular grid coordinate.

I am still having problems. When it is clear that the square is not reachable, it still think it is. If click on 1 and then the second square that I circled I get this

Could you post a Screenshot of the graph in those cases?

I can’t really recreate this, but what do you mean by Screenshot of the graph? You mean the A* gameobject which has the graph? short video of what happens
Do these links help?

I managed to solve the problem. The only thing I had to do is to scan after setting the destination, then I could see if the path is possible.

1 Like