What wrong with this code.The value of hp didt change when it touch the "LaserBeam" obj

public class bosshp : MonoBehaviour
{

[Header("hp")]

public float hp = 3;

private void OnCollisionEnter2D(Collision2D collision)
{

    if (collision.gameObject.name == "LaserBeam")
    {
        hp = hp - 1;
    }

}
void Update()
{

    if (hp <= 0)
    {
        Destroy(gameObject);
    }
    Debug.Log("idk" + hp);
}

}

Troubleshoot it.

Add a Debug.Log(“Hit!”) either above or below the hp=hp-1. If that doesn’t work make sure your collisions are properly set up. i.e: Make sure the laser has a collider on it and that you have a collider.

I add the normal collider but not 2Dcollider so it dont work
Thank you