I am working on my first real 2D unity game. I only recently started using URP to display my character behind barrels and cacti correctly. I am now using a fence tile set I created with collider boxes along the bottom edges of the fence. However, when the player's y-value is greater than that of the fence, the player incorrectly appears above the fence (It does appear correctly when the player's y-value is less than the fence's.
I think it has something to do with pivots, however when I try to adjust pivots, sprites do not perform as intended. Also, they are located on the same layer.
Thank you in advance for any help. Please ask if you need any clarification.
EDIT: Most of the fence tiles are two tiles in height. I switched the collider type to None for the tops of fences so that they wouldn't collide with the player. Could this be a problem?
You need to change a number of configurations to resolve your issue.
Sort Group
Component from the "Fences" gameobject. It is intended for something different and messes with sorting.Individual
. This is the intended mode for interweaving transparent tilemaps and other sprites. See here for more information.