Hey all.
I’m working on a 2D game. I’m trying to get trees to spawn in a way so that the trees with a lower y-position are rendered in front of trees with a higher y-position. I’m using URP, so I edited the Renderer 2D Data by changing the Transparency Sort Mode to Custom Axis and the Transparency Sort Axis to (0, 1, 0). I also changed the Sprite Sort Point for each object to be “Pivot”.
However, this is not working.
Each tree has the same settings:
I’ve tried adding a sorting group, but that didn’t work either.
Trees that are higher up in the hierarchy are always rendered first in front, no matter what.
make sure that you put the pivot on the bottom of the tree sprite
every tree must be on the same layer
every tree needs to be same order in layer
finally, make sure you assigned the 2d renderer correctly on the urp asset
Every tree is on the same layer, the pivot is at the bottom of every tree sprite, and every tree is on the same order in layer.
I’m pretty sure I set up my 2D renderer correctly. Are there any other methods to fixing this problem?
no that was all the steps, if you did everything correctly it should work
try doing it in a fresh project and see if it still doesnt work
Okay. Here’s what I did for the test project.
- Create a new URP unity 2022-3-LTS project
- Create > Rendering > URP Asset (with 2D Renderer)
- Make the Transparency Sort Mode to “Custom Axis” and set it to (0, 1, 0)
- Changed the URP Profile in the Graphics section in the Player Preferences to the new asset I just made
- Imported my sprites and set their pivots just like I did previously
It works. So now I just need to see what I did wrong in my other project…
Ok I just deleted my URP asset and created a new one.