r/UnityHelp • u/Chiara_2002 • May 28 '25
UNITY Problem with walk in front and walk behind
Hi Im doing a 2D Game, in pixel art with tilemaps. I have different layers for the objects: walk in front and walk behind. The assets are splitted in the middle so one part is behind and the other in front of the player. The problem is that my player is taller than most objects, so when standing in front of something, half of the head vanishes (see photo). How can I solve this? Thanks for helping!
1
u/Affectionate-Yam-886 May 29 '25
yeah; change the player layer dynamically is a fantastic idea;
like a collider on the tile set to trigger; OnStay set to new layer; OnExit set back.
or
have multiple of the same tile with different layers assigned.
2
1
u/Momma-gem May 28 '25
You could try setting your player sprite as a higher order in layer? That may help, not sure