2D sprite renderer isn't sorting sprites from the same layer/order based upon transform position

Hey all,

After upgrading my project to the latest Unity2020.3.23f1 version, I began having an issue in which the sprites in my project no longer were being sorted based upon their position, despite being on the same sorting layer, and the same order in that layer. Here are a couple pictures of a new scene to show what I mean. In this simplified example, I would expect whichever object is lower on the Y position to be rendered after (in front of) the other object.

I’d be grateful for any advice or guidance y’all might have on the matter. Thanks!


I don’t think anything in particular has changed in Unity 2020.3.23f1 regarding this. Sorting based on the Y position only works if Custom Axis Sorting is enabled using the Y axis. Could you check if that is the case? Otherwise, it would sort based on the Z axis (which appears to be the same for both your SpriteRenderers).

You can find out more details on how sorting works at Unity - Manual: 2D Sorting

You pointed me in exactly the right direction I was looking for, thank you so much. The issue was that (for whatever reason) the Universal Render Pipeline Asset I use in my project had the transparency sort mode reset to default, instead of being on that Custom Axis. With that changed, everything is sorting exactly as it should be. Thanks again.

Where did you set the sort mode of the pipeline asset? I had this same problem and everywhere I tried I could not change it.

PSA - For those having sorting issues with 2d sprites in 3D URP, the problem for me was that the Transparent Sorting Axis was reset in my project, and the option is HIDDEN in the URP Graphics settings. This solved the issue at the root level:

https://en.esotericsoftware.com/for…t-correct-in-urp-forwarded-rendering-unity/14

in case the visual helps anyone else, i also had this problem in my URP project and i found the Axis Sorting in a Renderer2D.asset (while digging around generally in the render setting files)