Converting "Physics.CheckSphere (worldPoint, nodeRadius, unwalkableMask)" into 2D

hi all, i am currently working on a getting A* working for my 2D game, to do this, i took some code from a tutorial and tried to convert it for 2D (was originally for 3D) with some success, the grid is created correctly and the player node changes colour, howver, it is not marking tagged objects as unwalkable on the nodes, i am sure this is something to do with the use of Physics.CheckSphere on line 34 rather than a 2D equevalent but i am just having no luck, any help would be appreciated.

// 1) Turned worldBottomLeft into Grid's private field.
// 2) worldBottomLeft is now calculated using nodeDiameter value instead of fixed .5f value.
// 3) NodeFromWorldPoint rewritten cause it was a mess.



using UnityEngine;
using System.Collections;

public class Grid : MonoBehaviour {
    public Vector2 gridWorldSize;
    public float nodeRadius;
    public LayerMask unwalkableMask;
    public Transform player;

    Node [,] grid;
    float nodeDiameter;
    int gridSizeX, gridSizeY;

    void Start () {
        nodeDiameter = nodeRadius * 2.0f;
        gridSizeX = Mathf.RoundToInt (gridWorldSize.x / nodeDiameter);
        gridSizeY = Mathf.RoundToInt (gridWorldSize.y / nodeDiameter);
        CreateGrid ();
    }

    void CreateGrid () {
        grid = new Node[gridSizeX, gridSizeY];
        Vector3 worldBottomLeft = transform.position - Vector3.right * gridSizeX / 2 * nodeDiameter - Vector3.up * gridSizeY / 2 * nodeDiameter;
        for (int x = 0; x < gridSizeX; x++) {
            for (int y = 0; y < gridSizeY; y++) {
                Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
                bool walkable = !(Physics.CheckSphere (worldPoint, nodeRadius, unwalkableMask));
                grid [x, y] = new Node (walkable, worldPoint);
            }
        }
    }

    public Node NodeFromWorldPoint (Vector3 worldPosition) {
        Vector3 localPosition = new Vector3 (worldPosition.x - transform.position.x - nodeRadius, worldPosition.y - transform.position.y - nodeRadius, 1);
        float percentX = (localPosition.x + gridWorldSize.x / 2) / gridWorldSize.x;
        float percentY = (localPosition.y + gridWorldSize.y / 2) / gridWorldSize.y;
        float xFloat = (gridSizeX) * percentX;
        int x = Mathf.RoundToInt (xFloat);
        x = Mathf.Clamp (x, 0, gridSizeX - 1);
        float yFloat = (gridSizeY) * percentY;
        int y = Mathf.RoundToInt (yFloat);
        y = Mathf.Clamp (y, 0, gridSizeY - 1);
        return grid [x, y];
    }

    void OnDrawGizmos () {
        Gizmos.DrawWireCube (transform.position, new Vector3 (gridWorldSize.x, gridWorldSize.y, 0));
        if (grid != null) {
            Node playerNode = NodeFromWorldPoint (player.position);
            foreach (Node n in grid) {
                Gizmos.color = (n.walkable)?Color.green:Color.red;
      
                if (playerNode == n)
                    Gizmos.color = Color.cyan;
                Gizmos.DrawCube (n.worldPosition, Vector3.one * (nodeDiameter - .05f));
            }
        }
    }
}

Use Debug.Drawline or Unity - Scripting API: PrimitiveType.Sphere to draw something on that position to see if its in correct place / size?

Thanks for the info, actually fixed it already, replaced phyics.checkSphere with physics2D.overlayCircle or something like that.