Search Issue Tracker
Fixed in 2020.1.X
Fixed in 2018.4.X, 2019.2.X, 2019.3.X
Votes
6
Found in
Issue ID
1014187
Regression
No
[WebGL] RectMask2D does not mask
Reproduction Steps:
1. Open the attached project.
2. Open the SampleScene.
3. File->Build Settings->WebGL->Build and Run
What's Expected:
- The text should be clipped. You can see that in the Unity Editor's Scene and Game tabs.
What's Perceived:
- The text is not clipped when the project is run in the WebGL player.
Additional Notes:
- I've done my best to confirm that this issue is isolated to WebGL and works on other platforms (enabling IL2CPP and running in OpenGL ES compatibility).
- From my newbie eyes, it looks like the UNITY_UI_CLIP_RECT shader #define is not accepted in all cases on WebGL, by the graphics device.
Workaround:
1)
- copy UI/Default shader to the Assets folder and change the name in the source (UI/Default => UI/Custom)
- create a new material that uses the custom UI shader
- assign the new material to the UI objects
- at runtime use EnableKeyword("UNITY_UI_CLIP_RECT") on the material
2) use Mask component instead
Comments (8)
-
Bunderant
Feb 15, 2019 19:08
Gotta say, this is a pretty frustrating "Won't Fix". I've been using RectMask2D wherever I could get away with it, being the recommendation to use where possible for general UI optimization.
I feel like you guys should at the very least provide a warning that it won't work in builds in the component inspector (if set to the WebGL platform), and provide the same warning in the console output after a build if any included scenes or prefabs use the RectMask2D component.
-
undefined666
Sep 10, 2018 13:12
+1.have this issue too.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android] Safe area ignores navigation bar on Android when targeting level 35 API or higher
- File watcher does not trigger after the AcquireFloatingLease and before the Entitlement check
- HDR Output gets disabled in the Editor when Reflection Probe is enabled during runtime
- The "Build and Run" Menu option tries to build for the selected Build Platform instead of the Active Build Platform
- Font kerning breaks at runtime when multiple UI Documents use different fonts
Resolution Note (fix version 2020.1):
Currently not fixing since there are workarounds available.
Workaround:
1)
- copy UI/Default shader to the Assets folder and change the name in the source (UI/Default => UI/Custom)
- create a new material that uses the custom UI shader
- assign the new material to the UI objects
- at runtime use EnableKeyword("UNITY_UI_CLIP_RECT") on the material
2) use Mask component instead