# How to access and change a Tilemap's Order in Layer?

I'm making a game about two ghosts, and an important thing that I want to add is the possibility to pass through walls. I have managed to make the passable behaviour and everything.

Next, I need to change the Tilemap's Order in Layer number. That's because I want to add some things inside the Tilemap that should be shown until player passes the wall. The way I though of to do this is to decrease the tilemap's layer order when the player is inside it, and put it back to the previous value when player exits.

• Have you tried Renderer.sortingOrder ? Sep 24 '20 at 14:56
• Yes i found it already. Thanks, my problem is solved Sep 24 '20 at 15:14
• Glad to hear you've solved your problem! Want to write up your solution as an Answer below that you can mark as Accepted? This can help future users, and also earn you some reputation from folks who find your answer useful. Sep 24 '20 at 15:17
• Please post that as an Answer below, not as a comment. Sep 26 '20 at 0:33
• yeah hah i'm new using StackOverFlow sorry Sep 26 '20 at 0:34

I solved my problem with GetComponent<TilemapRenderer>().sortingOrder = x;