Search Unity

Scrollview not masking elements

Discussion in 'UGUI & TextMesh Pro' started by matthewseaward, Jul 17, 2016.

  1. matthewseaward

    matthewseaward

    Joined:
    Apr 12, 2013
    Posts:
    50
    Hi,

    I've had a series of scrollview that contains a series of buttons with images. However since upgrading to 5.3.4 the buttons are not being masked by the scrollview and remain visible.

    The text component on the button however is being hidden. Why is just the text being hidden and not the image?

    Before scrolling
    You can see that only the text "Mud 2" is masked - the image isn't

    After scrolling
    See how the 'Dry Grass' text is correctly masked - but the image isn't?


    As I said, I haven't changed the code or the scene since upgrading and this is something I have only just noticed after upgrading. I'm guessing something UI based has changed in the update. What do I need to get them properly masked?

    The buttons are comprised of a Button Script, a Image (main image), text and a Raw Image (to display the yellow cross)
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @matthewseaward

    Hi, only thing I can think of, is that you have accidentally assigned some non-UI material to those GameObjects that have Image components + texture tile images, and that way they don't get masked. But then again, you should see warning about Stencil_property.
     
    Pozonu likes this.
  3. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @matthewseaward - Another idea, have you tried replacing Mask component with newer Rect Mask 2D? Although I don't like it as it craps out if container having mask component is rotated...
     
  4. matthewseaward

    matthewseaward

    Joined:
    Apr 12, 2013
    Posts:
    50
    Yeah, the images aren't UI sprites. They are materials and I'm applying the texture to be used as the image. Unity never had a problem with this before...

    But your suggestion to use the newer Rect Mask 2D seems to have solved the issue! Thanks!
     
    Kiremit likes this.
  5. Kiremit

    Kiremit

    Joined:
    Sep 9, 2020
    Posts:
    2
    Thats exactly the solution ! Thx
     
  6. Deleted User

    Deleted User

    Guest

    2022 now, switching the Mask on my viewport GameObject over to a Rect Mask 2D solved the issue for me