Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Sprite masks not working.

Discussion in '2D' started by TylerJay-B, Aug 23, 2022.

  1. TylerJay-B

    TylerJay-B

    Joined:
    Dec 29, 2018
    Posts:
    18
    I have some prefabs which contain masks, these masks normally work throughout except when the object is over one of my background tilemap layers which are controlled by an overlapping mask layer which essentially provides the layer with a tiled texture.

    My prefabed object's masks work perfectly when not over this tilemap layer, and I think they must get confused by the mask otherwise.

    The background is using a material : Sprites/Stencil Mask Main

    I guess, this is less of a bug and more of a question, how would I go about making this material only effect a specific layer.
     
    Last edited: Aug 24, 2022
  2. DanielTanBK

    DanielTanBK

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Hello,

    To get a mask to only affect a specific layer, you can enable the Custom Range option and select the custom sorting layer and order in layer that it affects
    More details here: https://docs.unity3d.com/Manual/class-SpriteMask.html

    If that does not work and you think its a valid bug do use the Unity built-in bug reporter to file a ticket with your reproducible bug project attached, let us know the ID and we can have a better look