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. Dismiss Notice

Question sorting group and Transparency Sort Mode

Discussion in '2D' started by gyuyungahn, Jul 23, 2022.

  1. gyuyungahn

    gyuyungahn

    Joined:
    Mar 19, 2022
    Posts:
    7
    Hi guys.

    I'm making a 2D top-down game. it is farming game.

    I used 2D character creation Assets called "SPUM".

    "SPUM" is a character generator that combines several sprites.

    Like this.

    Q-1.png

    The characters created are invisible objects and have many child objects. The top object of that child is the 'Sorting Group' built in.

    like this.

    Q-2.png

    I want to change the order of the renders of agricultural products and characters according to the pivot.

    So I referred to the following link.

    https://learn.unity.com/tutorial/de...0021b1bc7c&uv=2020.3#5ce27f80edbc2a055f53f30e

    But the characters consisting of several sprites are not shown on this link. I looked up how to apply the contents on this link to the character 'sorting group' through Google.

    and i found.

    https://stackoverflow.com/questions/59163373/set-a-custom-sorting-point-without-changing-the-pivot

    this.

    This link explained that it is automatically output along the 'pivot' of the object with the 'sorting group' component.

    so i change my charactor's sorting layer 2,
    my plants too.

    Q-3.png


    To sum up the information on the two links, if I go up above the corn, the character has to hide behind the corn, but isn't.

    Q-4.png


    When I was writing, I thought about how about we put both sorting groups as default...

    The character just came up higher.

    i need help... TT...
     

    Attached Files:

  2. rarac

    rarac

    Joined:
    Feb 14, 2021
    Posts:
    570
    u have to do a few things

    1st you must make your transparency sort axis sort by z (0,0,1) or (0,0,-1)

    2nd you must keep a variable on each character or crop that is the Y on their feet ( y - pivot offset u want)

    3rd you must set the z of the sorting group gameobject equal to the variable y on the feet whenever the character or crop move

    4th objects on all the same order in layer, and floor on different than objects

    if you do all these steps it should be fixed