Hello,
My question may sound stupid, but how do i make my character show when he is in front of the house and hide when he is behind ?
Thx ^^ Mystogan
Hello,
My question may sound stupid, but how do i make my character show when he is in front of the house and hide when he is behind ?
Thx ^^ Mystogan
Depends on your game. You might want to do this with the sorting order property of the SpriteRenderer if your sprites are on the same sorting layer. You could for example write a script that changes the sorting order depending on the y-position:
sprite.sortingOrder = Mathf.RoundToInt(transform.position.y); //or whatever calculation is best for your game
Alternatively you could work with the z value of your GameObjects.
If it’s feasible you could also cut those houses in half and put one part below the player and one part above the player in the sorting layers.