Search Unity

Question How to calibrate the dinamic sorting group in a 2D top down environment?

Discussion in '2D' started by DANTONFSF, Mar 17, 2023.

  1. DANTONFSF

    DANTONFSF

    Joined:
    Apr 26, 2022
    Posts:
    6
    Hi friends.

    I'm on an URP project. I'm struggling with this:



    As you can see, it's almost good. But I don't know how to calibrate this distance to get the perfect changing order automatically.

    Both objects are in the same layer. Both have an identical sorting group in the exact same layer and order in its upper parent sprite. Both objects have Sprite Sort Point marked as Pivot.

    The Renderer2D profile is set as transparency sort mod as custom axis (x=0, y=1, z=0)

    Any help?
     
    Last edited: Mar 17, 2023
  2. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    602
    > Both objects have Sprite Sort Point marked as Pivot.

    That's half of the work. The other half is to correctly position pivot for each sprite using sprite editor. For the drawing style like that the pivot should be placed near the foot.
     
  3. DANTONFSF

    DANTONFSF

    Joined:
    Apr 26, 2022
    Posts:
    6
    Perfect! I was needing to correct each sprite pivot position (mark it to the bottom).

    So, if you are struggling with this too, follow these steps:

    1 - Edit each sprite individually - set the pivot point to the bottom - in the root sprite editor
    2 - Put the objects in the same layer.
    3 - Put an identical sorting group in the exact same layer and order (in its upper parent sprite if it is an object with chidren objects)
    4 - Set Sprite Sort Point marked as Pivot, even in the sprite renderer at the inspector
    5 - Set the Renderer2D profile as transparency sort mod and set the custom axis like this: (x=0, y=1, z=0)
     
    karliss_coldwild likes this.