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.09k stars 269 forks source link

Softmask elements stop drawing on resolution change sometimes #208

Open NibbleByte opened 1 week ago

NibbleByte commented 1 week ago

Describe the bug Sometimes (for example when I just started the sample project), when tweaking the Power value while the game is running, everything in the soft mask stops drawing. Maximizing the game view (i.e. changing the resolution?) fixes it. SoftMaskNotDrawing

Similar thing happens on my original project, often when switching between fullscreen and window and clicking/drag the scrollview? - softmask stops drawing. To go fullscreen I use the Fullscreen Editor plugin (included in the project), but I don't think it's related. (in the gif, I switch to fullscreen via hotkey, so the whole image changes suddenly multiple time). Showing the pause menu overlay also fixes the drawing (enabling game objects?) SoftMaskNotDrawing2

I have updated my project to include the stripped down of my original game setup with all the code. Look for "PaperMap.unity" scene for the game version and "PaperMap-Old.unity" for the previous sample project with the "Power" feature. But generally, both scenes experience the issue, most often on resolution change.

Updated project link: https://drive.google.com/file/d/1rsZ8mC24-38FF9fYEvkh7QYmd80dxJ83/view?usp=sharing

Toggle between windowed mode and fullscreen via "Fullscreen" menu at the top, or F10 hotkey (for me it's ALT+F2). The scrollview has some components that tweak the behaviour, which may be important? Note that in my projects, I've turned off assembly and scene reloads (if it makes any difference).

To Reproduce Steps to reproduce the behavior:

  1. Open the "PaperMap.unity" scene. Restart the editor.
  2. Check if level icons are visible after opening the editor in the scene. Sometimes they're not. If they're not, toggle fullscreen (not in play mode yet).
  3. Play the scene. Code replaces the level icon slots with the "real" instances (deactivates the old, instantiates the new prefabs).
  4. Press "Unlock" button at the bottom left corner to show all the levels.
  5. Try toggling between fullscreen/maximized/windowed mode, scroll by dragging the content area or the scrollbar, click anywhere. Do these things in different sequence.
  6. Note that sometimes masked objects disappear and reappear inconsistently.
  7. If objects disappear, press ESC to show the paused menu - objects appear again in the background.

Environment (please complete the following information):

mob-sakai commented 1 week ago

Thank you for your reporting!

oktayturkdagli commented 1 week ago

I think you are in the same situation as I was in before. I thought this was solved, but the problem still persists in some spots. Especially when you want to do a masking in scroolview, UISoftMask cannot keep up with the scrolling speed. Especially when done in wordcanvas + scrollview, it really exhibits inconsistencies. I didn't have a chance to download and test your project, but I suggest you try the following temporary solutions.

mob-sakai commented 15 hours ago

The issue is reproduced on my environment. The soft mask buffer is not being updated correctly, or the dirty flag is not set.

mob-sakai commented 6 hours ago

Fortunately, the issue did not reproduce in the build.