Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Sprite Mask ignore Sorting Group

Discussion in '2D' started by Viole, Nov 2, 2023.

  1. Viole

    Viole

    Joined:
    Dec 29, 2015
    Posts:
    38
    Using Sprite Mask on a gameobject that has a Sorting Group causes the SpriteMask to only affect the children of the gameobject.
    Why are these 2 separate components connected in such a way?
    How do I get around this behavior?
    I want to use a Sprite Mask on an object with a Sorting Group and have it affect all other sprites in the scene.
     
  2. sildeflask

    sildeflask

    Joined:
    Aug 16, 2023
    Posts:
    313
    its a feature.

    if you dont want it, remove the mask from the object with the sorting group

    if you wanted a mask to affect only certain things, how are you supposed to do it without the sorting group mechanic?

    think about it

    if you remove this there would be a ton of people complaining that 1 mask affect everything when they want it to affect only things in one group
     
  3. Viole

    Viole

    Joined:
    Dec 29, 2015
    Posts:
    38
    I don't want to remove the mask. I want to have a mask with a Sorting Group that affects all sprites in the scene.

    I believe there should be a separate component called "MaskingGroup" that would serve your use case.
    Or at least give me an option to disable Sorting Group effects on masks.

    Masking and sorting are 2 completely different things, they should not be bundled into one component.

    So again, is decoupling these two possible?
     
    Last edited: Nov 2, 2023
  4. sildeflask

    sildeflask

    Joined:
    Aug 16, 2023
    Posts:
    313
    no