Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  3. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity UI Shader that hides what is behind it.

Discussion in 'Unity UI & TextMesh Pro' started by _Daniel_, Jul 16, 2017.

  1. _Daniel_

    _Daniel_

    Joined:
    Feb 28, 2007
    Posts:
    2,505
    Does anyone have a UI shader that essentially cuts a hole in the UI? I tried the DepthMask shader from the wiki with no luck. Everything behind the image would be invisible revealing the camera that is behind.
     
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,591
    You can achieve that through various means, wither using a RestMask2D with the appropriate image.
    Or alternatively use the Soft Alpha Mask UI component in the Unity UI Extensions project (link in signature) which can use alpha masking to mask an image.

    hope that helps.
     
  3. _Daniel_

    _Daniel_

    Joined:
    Feb 28, 2007
    Posts:
    2,505
    I don't believe a Mask can achieve this effect. To clarify, I am having my Camera's viewport rect conform to a RectTransform as if it were an image itself. This is why I would like my camera to essentially block the UI controls that are behind it.