Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UI mask not working on certain background

Discussion in 'General Graphics' started by kai_226, Mar 28, 2020.

  1. kai_226

    kai_226

    Joined:
    Jul 6, 2017
    Posts:
    53
    Hello,

    I am creating a health bar that resides inside a shaped frame. I am using the UI Mask to achieve this effect. Here is my setup:
    The parent object has the background and the mask:
    http://prntscr.com/roiwc9
    The child is just an image without a sprite:
    http://prntscr.com/roiwxq

    Everything works well in most cases:
    http://prntscr.com/roiyqu
    However, in a few special cases, the mask seems to fail:
    http://prntscr.com/roiycn

    It depends on what 3d gameobject is "behind" that mask as it seems. However, in both the good and bad example the gameobjects share the same material.

    The canvas is set to Screen Space - Camera.

    Am I doing something wrong with the mask?

    EDIT: Resolved, it was a shader problem.
     
    Last edited: Mar 31, 2020