Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

UI Masks not working?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Muzlu, Nov 16, 2017.

  1. Muzlu

    Muzlu

    Joined:
    Feb 4, 2015
    Posts:
    12
    Recently updated to 2017.2 and my ui masks stop working. In editor items are masked but after i press play -> items are not masked anymore and i can see them whole.. (i used mask and rectmask2d to check and none are working).

    Can anyone try if masking working in test project?
    In worst case i will reinstall older version.

    EDIT: Please ignore/remove -> after conversion to new version unity added strange materials to my Text elements and this was messing all up.
     
    Last edited: Nov 16, 2017
  2. Muzlu

    Muzlu

    Joined:
    Feb 4, 2015
    Posts:
    12
    Still same error -> mask is not masking.
    I have to deactivate and activate canvas to make it works (in editor or in code on runtime).
    After i made build for android -> same mask not masking.
    On gameplay if canvas is deactivated and activated again -> mask is working great.
    I hard programmed setactive on canvas to reload it but it is not how it should be i think :]
    Also i start getting this error:
    Assertion failed: TLS allocator ALLOC_TEMP_THREAD...

    this is making me mad.
     
  3. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    843
    I'm experiencing Rect2DMasks breaking since moving to 2012.2.0f3. (2012.1.1p4 was fine). 2012.2.0p1 and 2012.2.0p2 are the same.

    My UI is broad and deep, with a lot of masked elements, which were all broken all the time. I've spent a lot of time trying to isolate and reproduce it, but it's pretty hard to nail down the problem. I'm using custom UI shaders and TextMeshPro, but neither of these should affect Rect2DMasking (I'm not using the Mask component as not all Android devices support stencil buffers - mind this isn't a problem for you on your Android builds).

    A hacky fix seems to be adding an empty panel with a Rect2DMask component (and no child to acutally mask) to the bottom of the Canvas heirarchy. This reduce the incidences but doesn't eliminate it completely for me; the Rect2DMasks will still break at times I popup panels or other elements, and restore when i hide them again. Perhaps it's related to canvas depth/sorting.

    I'm crazy backed up with work, otherwise I'd have bugged it a week ago already, but it's pretty annoying and it's not the only thing I've hit with 2012.2.0 (i have a prefab with a child object that insists on changing it's heirarchy order).
     
  4. Muzlu

    Muzlu

    Joined:
    Feb 4, 2015
    Posts:
    12
    I disabled Depth and Stencil in Player settings on build -> and helped this time. Will see for how long.
    Can anyone explain why material on some TEXT component disabled masks in whole game? These were only on same canvas.
     
    lior_rosenspitz likes this.
  5. lior_rosenspitz

    lior_rosenspitz

    Joined:
    Jan 24, 2015
    Posts:
    24
    Same here. This was the solution for me as well.
     
  6. youbek123

    youbek123

    Joined:
    Nov 4, 2016
    Posts:
    16
    I use RectMask2D, However, works well only in first play!, But did some trick, by default I disabled RectMask2D, did custom script that enables RectMask2D in start. Now it works like a charm!