Unity2D: Changing the Sort Axis when using the Universal Render Pipeline Asset

Hello everyone,

I remember completing a Unity tutorial called “Ruby’s Adventures”, where in the guide it shows you how to make it so that when the player is behind a box it appears in front of you, and behind the player if the player is in front of it, based on the y-axis value of the player and the box. This is done by changing the Transparency Sort Mode and then the Transparency Sort Axis.

I am currently using the Universal Render Pipeline Asset, and I believe because of that the option is blocked for me:

I am guessing there is probably some other way to solve this issue, here it is visually:

7389893--902210--upload_2021-8-4_17-55-40.png

My player always appears in front of the box, or behind the box depending on the order of their sorting layers. Is it possible to somehow make it so that my player will appear behind the box if it is higher, and in front of it when it is lower? Just like the tutorial?

Bonus Problem: I feel like a solution for this issue will inevitably include the y-axis values for the player and the box. My other issue is the same problem, but with my walls which are a tilemap. The extra problem here is that, the y-position for my “Wall” game object which houses the tilemap is always 0, whether the wall is behind or in front of me. How could this be solved?

7389893--902213--upload_2021-8-4_17-58-30.png

Right now the 2nd image looks right, but the 1st one is off. I can change the sorting layers around but then my player would always appear above, in which case still it wouldn’t be solved.

Thanks in advanced for any help!

Hey,

I’ve never actually changed the Transparency Sort Mode when using URP, so I got a bit curious myself. It turns out the option can be found in the Renderer that’s plugged into the Pipeline Asset. The default name for the 2D Renderer is “New 2D Renderer Data.”

Unfortunately, I’m not really sure about the tilemaps issue.

Hi @Ziberian , yes you can find the Transparency Sort Mode and the Transparency Sort Axis in the Renderer 2D Data Asset Inspector.

If you change the Transparency Sort Mode to Custom Axis and the Transparency Sort Axis to be Y-sorted by setting the values to 0,1,0 for XYZ respectively, then that should do the trick for you.

7404113--905075--Renderer 2D Data (1).png