How to check collision on tilemap.

So I want to check collision whenever player collide with tilemap which is specifically walls. I use OnCollisionEnter2D, Debug.Log to check it and it’s not working. There is no collision between player and walls. I also put the wall rigidbody2D to static since this is a 2D game and I don’t want the walls to fall down. A little help here would be great!

Do you have a TilemapCollider attached to the tilemap? You probably also want to remove the rigidbody2D from the walls, if you dont want them to move. Rigidbodies should only be used for objects you want to move.