Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Embedded Masks?

Discussion in 'UGUI & TextMesh Pro' started by tarahugger, Sep 1, 2014.

  1. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    For masks to be very useful they need to work as children of objects that already have a mask. So i can create a button with its own mask and have it inside a panel that also has a mask.

    Currently only the parent-most mask will take effect. Which aside from being confusing and unexpected, makes prefabs using masks unpredictable - depending on the where your prefab is placed in the hierarchy it might get completely broken by a parent mask.

    Here's a use case i thought i could solve with masks. I have a large texture that contains scratches and tarnish that i want to use across multiple UI elements and have it apply nicely on top of sprite sliced tile/stretch behavior. I thought, simply drop the scratches image on my button, move it around for a random seed and have a mask on the button clip off all the excess.

    Instead to solve this i used Multiple materials on uGUI/Unlit/Detail with the scratches set to Detail channel and different offsets for each material. Then use PositionAsUV1 on the button to apply the scratches - but this approach is convoluted, unnatural and comes with its own downsides.

    Masks also need to have blended edges.
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,181
    Nested masking should work. I just tested it here and it's working as intended.

    Soft masking is non trivial to implement and will not be in the first release.
     
    tarahugger likes this.
  3. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Case 62988
     
  4. robertohuertasm

    robertohuertasm

    Joined:
    Aug 29, 2014
    Posts:
    44
    It seems that unity only accepts two nested masks for what I've tried. Is it the expected behaviour?
     
  5. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    25
    Having the same issue.
     
  6. pleribus77

    pleribus77

    Joined:
    Jul 9, 2013
    Posts:
    36
    Same issue here, seems to be a regression from Beta, where nested masks worked at mutliple levels on hierachy.(more than 2 levels)
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,181
    Bug# for this?
     
  8. pleribus77

    pleribus77

    Joined:
    Jul 9, 2013
    Posts:
    36
  9. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,181
    thanks
     
  10. pleribus77

    pleribus77

    Joined:
    Jul 9, 2013
    Posts:
    36
    Any ETA on when this may be looked at (have a deadline of mid Jan) - and want to know if I should look at other workaround for a series of scroll list windows.
     
  11. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,181
    No promises, but I'll try and look at it next week.