- Home /
question about sorting layer in a topdown 2D,Hi!
I'm making a top down 2D game, the problem is that if I put the character on a lower sorting layer than an obstacle (i.e. tree) when he walks in front of the tree, he will be in front of it, but if he walks behind the tree, he will still appear on top of it. how do I solve this? ,
Answer by Zaeran · Dec 15, 2021 at 06:48 AM
The typical way to solve this is to adjust the sorting layers based on the z position, so that as your character moves around, their sort layer will be changing.
how do I do that? also, I'm not using the z axis, its only 2d. (I think) (I'm really new to this sorry :/ )
Answer by ahmetanteryagiz · Dec 17, 2021 at 02:09 PM
Hello, you should follow these steps:
Project settings -> Graphics -> Transparency Sort Mode = Custom Mode
And set to X: 0, Y: 1, Z: 0
The player and the tree should be in the same sorting layer.
If you are using tilemap, you should also set "Tilemap Mode: Individual".
Also detailed video: https://www.youtube.com/watch?v=q-r1YJzj28M
Your answer
![](https://koobas.hobune.stream/wayback/20220613050554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Render sprite only on top of a specific sorting layer 1 Answer
Editor SortingLayer masking? 1 Answer
2D Animation does not start 1 Answer
Sorting sprites for render in 2D 3 Answers
Best way to handle Sprite sorting in compound objects? 2 Answers