Search Unity

UI Mask & Masking Layer Limit

Discussion in 'UGUI & TextMesh Pro' started by Stephan-B, Dec 1, 2014.

  1. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Given the following scene where the Green, Blue and White labels have a masking component. When the White and Blue masking components are enabled, the text is masked as expected. When masking is enabled on the Green label (making it 3 layers), the text disappears. Is this by design and a limitation of the system or is this an issue?

     
  2. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
    We're running into the same issue where we have a super complex UI with sub windows and such. The masking limit of 3 is throwing monkey wrenches for the sub panels.

    Is there a way we specify the mask level limit ourselves (I'm sure there's a limit for a reason). We could probably get away with ~5.

    Sample of the panels we're doing (not the most complex though - those aren't masking right):
     
    Last edited: Dec 2, 2014
  3. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
    We're having a hard time building any moderately complex panel with the mask limit. This panel is a Window (content mask), scrolling list (content mask), then the dropdown has a scrolling list (content mask) which is failing (showing white box):
     
  4. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
    Is this a "feature" or a "bug"? I can put in a bug report, but it's definitely hardwired into the engine. This is unfortunately preventing us from fully converting our current tools from using scaleform to unity (and we *REALLY* want to break free from scaleform! haha). This is literally the last thing we need to have the tools converted.

    I will say at points, we probably have 300+ UI elements going and there's no noticeable slowdown.
     
  5. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Can we get a confirmation that 3 layers of masking is the maximum supported or if this is an issue that should be reported?
     
  6. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
    Bug reported (Case 654689). Includes sample project showing masked prefab stack:



    The children of masks start failing at the 3rd mask level, so we only really have 2 valid levels of masking. Seems crazy shallow.
     
    Last edited: Dec 9, 2014
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    hey this is a BUG, it should support a larger number than 3 (8 I believe, but I'd have to check the code).
     
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    It fails past 3 right now.

    Could you please explain how the Stencil ID is computed?
     
  9. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    It should just be the depth under the mask. So if it's 3 elements nested it should be 3, we use this as the write mask.
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    When going 3 deep, I have to set the Stencil ID to 11 right now. So maybe something is up.

    1 Layer = Stencil ID 1
    2 Layer = 3
    3 Layer = 11

    That is when I set the Stencil ID manually in the shader.
     
  11. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
    woot! glad you guys are on it (and that it is a bug)! can't wait to de-flatten our panels! =D
     
  12. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Was there a number for this, just for tracking purposes?
     
  13. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13

    ^

    Thanks again!
     
  14. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    ahh blind :)
     
  15. theiss

    theiss

    Joined:
    Oct 3, 2012
    Posts:
    13
  16. dyy

    dyy

    Joined:
    Mar 15, 2014
    Posts:
    6
    Hey, I got this bug again at 5.1.2p2. Any solution?
     
  17. dyy

    dyy

    Joined:
    Mar 15, 2014
    Posts:
    6
    Well, seems like its my custom shader's problem. I will try to compare it with the sprites-default shader.