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

Overlay for UI elements?

Discussion in 'UGUI & TextMesh Pro' started by UnbridledGames, Oct 20, 2020.

  1. UnbridledGames

    UnbridledGames

    Joined:
    May 12, 2020
    Posts:
    139
    I have a complicated UI element which does not have a background to it. It's a bar in a preferences menu which has a title, a variable input field (could be a slider, a text input, etc) and some layout elements to it.

    I'm trying to make the bar be "disabled" by graying out all of it. Problem is, without a background that grays out with it, I cannot just overlay a somewhat transparent image overtop to gray it out.

    Is there a way to create an overlay that has transparency, and effects objects behind/underneath it, but only to a certain depth? For example - anything X number of parent items up, it stops affecting? Or if the objects are in a different canvas sorting layer?

    I'm also looking to apply this elsewhere. I have some TextMeshPro text which I'd like to apply some shaders to, and despite my googling and forum posts, it seems without some seriously custom shaders, thats not possible. But if there were an overlay that could be applied, the shader could apply to the overlay, then stop affecting anything behind it after a certain 'distance'.

    Is this something thats currently available? If not and someone knows a good place to start looking in the code, I'd appreciate being pointed in that direction. I can probably make this work on my own, but don't want to waste the time if it's already available or not really possible.

    Thanks