Object can't visually block.

The character in the red circle is behind the ground ( in z axis), but it still shows in the camera. No matter it behind anything, it can still show in the camera.

I want to know is it I switch on any function which makes it happens.

Thank you.


You can change the sorting layers of your objects. For instance you want your player be always drawn on top of everything so you can take a look at your player’s SpriteRenderer component and change the OrderInLayer to suit your needs. Similarly, you can do this to your enemy’s also. The higher the value the more it is drawn on top of things. For instance you have your grass on 1 value so if your player is on 0 it will be drawn behind the grass. You can also assign sorting layers to your objects instead of changing OrderInLayer. For instance you can add a Environment Layer and a Player layer so you can see (when you add the layers) that there is a first and a second layer you can drag the second layer by holding the three lines sign and drag it up. The first layer will be drawn on top of all other layers. Then you can assign them in the Inspector.

Hope this would answer your question.