Search Unity

2D Bone Depth not stacking sprites correctly?

Discussion in '2D' started by BionicWombatGames, Oct 23, 2020.

  1. BionicWombatGames

    BionicWombatGames

    Joined:
    Oct 5, 2020
    Posts:
    33
    In the attached picture, I've got the Right Arm bone chain parented by Upper Back. Upper Back and Lower Back are set to depths 11 and 10, and the Right Arm chain is 50/51/52. Shouldn't right arm then be appearing in front?

    Right Arm is its own sprite, and the torso is its own sprite. View attachment 722379

    https://i.imgur.com/yETgLOo.png

     
  2. BionicWombatGames

    BionicWombatGames

    Joined:
    Oct 5, 2020
    Posts:
    33
    I was able to solve this by changing the layer order in the PSB file (via the scene object -> Model -> Open), then refresh. I will file a bug that bone depth does not working when using the PSD importer.
     
  3. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Hey @BionicWombatGames yes that's the correct way to change the layer order of Sprites in a PSB file.

    The bone depth values on the other hand, affect only triangles in a single Sprite mesh i.e. the Depth only influences the same Sprite Mesh, for example, your entire arm L.

    Rendering order of Sprites like you found out is still controlled by the Sorting Layer and Order in Layer option on the Sprite Renderer.

    Sorting Layer Order.png

    Take for example, in the Dragon Crashers - 2D Sample Project, the Primary character has a single Sprite arm L which is being weighted/influenced by 3 different bones, arm_l (pink), forearm_l (red) and hand_l (green).

    If I change the Depth of bone forearm_l to be -5 while keeping the rest at 0, the forearm will rendered below/behind the same Mesh. It would not reorder the arm L mesh below/behind the torso which is a different Sprite.

    Lower Bone Depth.png

    Likewise. if I change the Depth of bone forearm_l to be 5 while keeping the rest at 0, the forearm will rendered above/in-front the same arm L Mesh.

    Higher Bone Depth.png

    Hope this clarifies!
     
    Naminuz likes this.