Soft Mask Script not working when it is a child of another Mask
Issue created by Hugo Daniel Campos as Bitbucket Issue #212 on 2018.02.17 23:52. (Updated title to reflect current issue)
Hi, I'm using the 2.0 release and I can't make the soft mask work inside a scroll view. The image completely disappears from the screen on play.
This is what I planned to show (before play mode):

This is what happens when I run the project:

All the images that uses the Soft Script Mask fail to work. On play mode if I disable and enable the objects again, the images are visible again but when I drag the scroll view the mask seems to get stuck in the same area while the images move with the scroll view:

I am also using Soft Mask Script outside the Scroll View, it works as expected. This look like a bug to me, I am not using anything other than unity Scroll View and Soft Mask Script. But if I am wrong, please let me know what I am missing. Thank you!
(SJ) The SoftMaskScript has conflict issues when a Unity Mask is added in the hierarchy before the SoftMask effect.
On 2018.02.19 16:25, @SimonDarksideJ commented: After much tinkering, there is a way to mask the ScrollView. Seems Unity does something funky with the rendering of the ScrollRect which affects how masks work.
To make SAUIM work, you need to add an image as the Mask for your ScrollRect as a child of the ScrollRect (below the Content) as shown here:

Set it's Anchor to Stretch/Stretch and add the Soft Mask script. This will then work as expected:

*Note, if you don't want to let the user swipe when it's masked, then you'll need to add a canvas group component to the mask and enable / disable interactivity to block it.
On 2018.04.24 01:12, Hugo Daniel Campos commented: Hi Simon, thank you for answering so much faster than I am working on this project (it's a side project). This solution doesn't solve the problem. Each element of the "Content" GameObject have its own Soft Mask Script. Basically each element of the Horizontal / Vertical Scroll Snap has its own image that should be masked with a circle image.
I've noticed that the problem, actually, is not about the Scroll View nor the Scroll Snap, it is a Soft Mask Script within a Unity Mask problem.
I switched the default unity Mask for a Rect Mask 2D because the Mask is actually a Rect shape and the result showed better:
-
The Soft Mask Script is now masking the image
-
The Soft Mask Script is now moving with the Scroll Rect
-
What doesn't work: the Rect Mask 2D doesn't mask any image that has been masked by Rect Mask 2D.
On 2018.04.24 10:31, @SimonDarksideJ commented: Can you craft a simple test scene showing the issue, upload it "somewhere" and attach a link here? So I can experiment with your configuration.
On 2018.04.24 10:45, Kirill Velikiy commented: I did one. Google Disk link - https://goo.gl/ZQNQwF
On 2018.04.24 14:49, @SimonDarksideJ commented: OK, did a LOT!! of research today, including chatting with the original author of the SoftMaskScript.
Seems Unity are doing something if there is another Mask Higher in the Hierarchy that the soft mask script. If you remove the mask from the "Mask" element, it works fine.
Also, What it prevents is the mask from "Updating", so on start up, the mask works as expected, it just can't update the cutoff while running.
Will still see if I can improve that, but for now it seems to be a limitation on the control currently.
On 2018.04.25 09:24, Kirill Velikiy commented: Hope you fix it. Because for now it is impossible to use SoftMask on objects under the Mask :(
On 2018.11.28 10:14, Max commented: Hello, I'm trying to use SoftMask in scroll view. It seems the issue is still present...
Maybe this can help: I see that disable/enable the Image component that is masked by the SoftMask component will recompute the mask layer. Do it at each frame and you will have almost the wanted result (scrolling fast will cause some cutting effects) Also you can disable/enable the mask of the scroll view (not work in the same frame) to recompute all SoftMask under it.
This trick is heavy for CPU because it recompute the whole layout at each frame... But if it can help to solve this issue or help someone else.
Another possible workaround that worked in my case - it was enough to just untick "Maskable" on the image that was being masked in the soft mask. That made it appear while under the scroller (and also the image didn't show when outside the scroller).