Did you put it in a script attached to the player game object, ie the same object as the one having the collision object and the player sprite?
I encourage you to compare your project with one of the example project showing how to use a tilemap with collisions and a player game object. For instance this platformer: