debug.log Raycast doesn't return anything.

I got a problem today, out of no where, the raycast doesn’t seem to work. I debug drawline, it seem to work just fine. The function is also work normally. I can’t figure out why this doesn’t work. Does anyone have a clue? I did both reboot and restart project and this problem still stay. (+photo will show you all the detail of all the scene setup)
For detailing information: I use Unity verison: 2011.3.11f1, 2d urp
.

public class raycast_check : MonoBehaviour
{
    public LayerMask Ground_Layer;
    public Rigidbody2D rb2d;

    private void Start()
    {
        rb2d.GetComponent<Rigidbody2D>();
    }
    private void Update()
    {
        drawLine_();
        CheckRayCast();
    }
    void CheckRayCast()
    {
        //Debug.Log("raycast func, is working");
        if (Physics.Raycast(transform.position, Vector3.down, out RaycastHit hitinfo, 1.5f, Ground_Layer))
            {
            Debug.Log(hitinfo.transform.name);
        }
    }
    void drawLine_()
    {
        Debug.DrawRay(transform.position, Vector3.down * 1.5f, Color.red);
    }
}

I did talk with 2-3 programmer before coming up with this post they said they has no idea, so I looking forward to a more opening community who know what’s going on with the raycast.




9273444--1298589--Capture3.JPG

Don’t you need to use Physics2D.Raycast since you’re using 2D colliders?

As @flashframe points out, decide if you’re using 2D or 3D physics. They are completely disparate unconnected systems.

  • Physics is the 3D physics system
  • Physics2D is the 2D physics system

Generally in 2D you would use some form of overlap rather than raycast.

ty man, got a way out now!