How to make Player interact with Tilemap

Hello! This is the first time I want to use a tilemap and I wanted to ask something:

I want my Player to interact with some Tilemap tiles.

For example:
On the tilemap, there is a tile with a lever on it.
I want that if the Player comes to the tile, turns to it and presses ‘Z’ the lever becomes turned.
And that I then can read if the lever is turned.

(So I want to add Scripts and colliders to some tiles of the tilemap)

I hope that you understood my problem.
Thanks!

@NikitaDemidov
Instead of using Tilemap colliders, I use polygon ones, so I can control them, I make a new empty object and name it ‘Collider’ the make a polygon / many 2D box colliders. Then make a separate object called ‘Layer’ and put another collider over it and remember to check ‘Is Trigger’.
136513-unitycapute.png

Then in your code, write

Please remove the ‘$’ signs as they represent line breaks.

$private void OnTriggerEnter(Collider other) ${ $if(other.gameObject.tag == "Player" && Input.GetKeyDown(KeyCode.Z)) ${ $//Do Stuff; $//Testing if it works: $Debug.Log("Lever Pulled!"); $} $}
(This is C#)
Put this script on the lever collider and tag your Player as “Player”

Hope this works for you - Atomiser;
(If you need some more help, reply to this).