Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Resolved Transparency sort mode not working in URP

Discussion in '2D' started by igorsandman, Jan 15, 2021.

  1. igorsandman

    igorsandman

    Joined:
    Dec 26, 2013
    Posts:
    2
    I'm trying to sort my sprites in a 2D game with URP and Transparency Sort Mode set to Custom Axis 0,1,0. The Z sorting only works in the Scene view, not in the Game view. I tried to do what is explained here: https://forum.unity.com/threads/tra...93.1917298031.1610550622-170523125.1537693866 but it doesn't work.

    I've tried to do it in 4 different ways:
    1. I went to Edit > Project Settings and changed the renderer to none so the camera settings would appear. then I changed it to Custom and set to 0,1,0. then I set the renderer back to URP.
    2. I set the renderer to URP then created a 2D Renderer Data asset and set its sort mode to custom and the axis to 0,1,0.
    3. I made a static script as explained in the link above to set the sort mode project-wide through script
    4. I made a monobehaviour script that I attached to the camera which applies the sort mode to the camera specifically.

    None of these 4 method worked. If I use method 4 and debug.log the camera's sort mode it tells me it is indeed set to custom, yet it doesn't show it in the game view. I also tried reinstalling URP and recreating my renderer assets.

    My sprite are still sorting fine in Scene view, but not in Game view.

    How do I fix this?
     
  2. igorsandman

    igorsandman

    Joined:
    Dec 26, 2013
    Posts:
    2
    The issue was solved.
    For posterity, it was a bug with an asset that I as using. I contacted the developer of that asset and they solved the bug.
     
  3. Megalogue1

    Megalogue1

    Joined:
    Dec 17, 2020
    Posts:
    134
    Just found this while Googling the same problem. Method 1 worked perfectly for me. But why is this option being hidden from URP users if it works?
     
    Moitroid likes this.
  4. collinskeith

    collinskeith

    Joined:
    Sep 29, 2016
    Posts:
    1
    I had already done #1, but for me it didn't work until I also did #2. I think if you are using URP and you want 2d sprite sorting to work this way, you have to do both.
     
    jacobhouston_unity likes this.
  5. LetterAfterZ

    LetterAfterZ

    Joined:
    Jun 13, 2020
    Posts:
    1
    Note that when you're using URP, this setting just moves to the renderer asset. If you open that up in the inspector you can see the settings for custom sort axis in there instead.
     
    CC_YN, Torkia and Slaircaex like this.
  6. Pawciu

    Pawciu

    Joined:
    Jun 21, 2015
    Posts:
    15
    Thanks for the steps. I finally got it to work. Remember that sprites have to be on the same SortingLayer and have the same Order In Layer!
     
  7. robochase

    robochase

    Joined:
    Mar 1, 2014
    Posts:
    242
    any idea what the bug actually was? or what asset was breaking this? I've tried all of the above and it's not working for me for some reason