- Home /
Scroll Rect is not working with UI Mask
I created a gameobject with a scroll rect and image component. The scrolling part works fine. The problem is that when I add the mask component it doesn't hide any of my UI prefabs. I've been trying to fix this problem for the last 3 days but I couldn't find anything.
Answer by PitaNGura · Apr 24, 2020 at 10:50 PM
To answer my own question, I didn't find any way to fix this but I have found a work around it. I cut my background intro 2 pieces and set the sorting layer to 19 to the inner square and 21 to the rest of the background. I just added a canvas in my prefabs and set it to override sorting to layer 20. Basically I had to simulate the effect of a mask by playing around with sorting layers. I don't know if it is an Unity bug or I am forgetting about something but this fix seems to be working.
Answer by JellyQwerty199 · Apr 21, 2020 at 09:48 AM
I think that you should add a Rect Mask 2D component instead of a Mask component to the ScrollRect. Hope this answer helps you :)
I tried to add the rect mask and got rid of the mask but it didn't work. Do you have any other idea or a work arround?
Switching to Rect $$anonymous$$ask 2D fixed my masking problem. It also worked with with Text$$anonymous$$eshPro. Thank you!
Lifesaver indeed. Switching to Rect Mask 2D solved this issue for me as well. Thanks!
Your answer
Follow this Question
Related Questions
Unity UI - Data Management for GameObjects in ScrollRect/TableViews with Large Data Sets 0 Answers
new UI Mask soft cutoff 3 Answers
Find objects only viewable within mask 0 Answers
How to mask on a shader , limit a shader to an area in a ScrollView? 0 Answers
Graphics.DrawTexture is not working with GUI.BeginScrollView 1 Answer