Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. 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,575
    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,597
    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,575
    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.
     
  4. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,126