mob-sakai / SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
https://github.com/mob-sakai/SoftMaskForUGUI
MIT License
2.08k stars 269 forks source link

Raycast outside of visible area #61

Closed bourgeoismaxime closed 4 years ago

bourgeoismaxime commented 5 years ago

Hello, I started using the plugin yesterday to put soft masks on scrollview. It seems like raycast are hitting the UI elements inside the hidden part of the scrollview

Here is how my setup looks like : Problem Problem2 There is a huge text inside of a scrollview. The scrollview has a soft mask and the text is correctly masked when scrolled. At the beginning when the scrollview isn't scrolled at all, I can press the button. However, when I scroll, the hidden text goes above the button and prevents me from clicking on it. The text is a TextMeshPro component but I have the same problem with anything interactable I put in the scrollview with the raycast target enabled. Camera is in Orthographic, Canvas is in "Screen Space - Camera".

I created a repro project but it worked perfectly on it. I don't know what in my project causes the hidden element to still be interactable. Is there anything I have to add or set to have the raycast working only on the visible part ?

Environment (please complete the following information):

mob-sakai commented 5 years ago

Hi @bourgeoismaxime Thank you for your reporting!

bourgeoismaxime commented 5 years ago

Hello, I have found a workaround but haven't gotten deep enough in the debugging to understand why. My current solution is to place an image without sprite and a soft maskable on the viewport gameobject. With the image plus the soft maskable, it becomes impossible for me to scroll by clicking on the masked text.

Issue is that I still cannot reproduce that in the repro project maybe because it is too simple.

YenYaoHan commented 4 years ago

add rect mask 2d into your scroller ,it would be helpful.

image

mob-sakai commented 4 years ago

Since there has been no new discussion for a long time, this issue was closed. If the same issue arises, please re-open this issue.