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
- [Quest] Pitch Shifter causes audio degradation on Quest 2 devices when sped up
- "GUI Error: Invalid GUILayout" and "NullReferenceException" are thrown when adding Scenes to "Scenes in Baking Set" in Adaptive Probe Volumes
- Inspector window not updating when switching GameObjects in Play Mode while having a VR headset connected
- "UnityException: GetName can only be called from the main thread." erors are thrown when the Shortcuts window is opened and entering Play Mode with a shortcut
- [Android] Light2D visuals stacking over frames when using RenderGraph
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