Detecting collision with OnCollisionEnter2D not working

Hey,
I’m making a 2D “Avoid the Walls” game. I want a script that’s on the player to detect a collision with a wall, as well as a wall checkpoint (which check if the player has passed a wall, and counts 1 towards the score, etc.). I have tried everything but just can’t get the script to detect the walls or the checkpoint.
The objects are made as followed:

  • The wall pieces are both 2D sprites with a box collider 2D that is not a trigger. It also contains a kinematic rigidbody 2D

  • The wall checkpoint is exactly the same as the wall pieces, except is doesn’t have a sprite.

  • The player is a 2D sprite with a circle collider 2D that is not a trigger. It also contains a kinematic rigidbody 2D.
    This is my script (I cut out the unnecessary parts):

    void OnCollisionEnter2D(Collision2D collision) {
    if (collision.gameObject.tag.Equals(“Wall”) == true) {
    Debug.Log(“Collision”);
    // Game Over Screen //
    }

     	if (collision.gameObject.tag.Equals("WallCheckpoint") == true) {
     		score++;
     		Debug.Log("Wall Passed, Score is " + score);
     	}
     }
    

Does anybody know what might be happening here? Any help is greatly appreciated!

EDIT: “score” is an int variable that is defined before Start()

i dont know but i would be using if(collision.gameObject.tag=="Tag");
maybe would help?