Problem with layer mask and nodes

I’m following this tutorial about pathfinding: A* Pathfinding (E02: node grid) - YouTube

I’ve followed all the steps but, when it’s time to run the game, this happens:

As you can see, all the blocks are white. But they should turn red if one of the objects (the red square on the top left) is in the “Unwalkable” layer.


I’ve uploaded the code that I’m using for this.

If anyone can point out what’s wrong, that’ll be appreciated.

Well, don’t know if you are still interested, but after long time of debugging I solved it. If you are using 2D and OverlapCircle, your object transform position is not actually moving so the Circle is drawn in the middle of the map. That is why all of them are white, if you put something in the middle it will all be red. So my solution to Your problem is:

bool walkable = !(Physics2D.OverlapCircle((Vector2)worldPoint, 0.1f, unwalkable));