Search Issue Tracker




Found in

Issue ID




[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.

- 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 (5)

  1. A4a31ce45a0434ddd6cf9929ee62d50e?d=mm


    Oct 14, 2019 15:00,21279/20110705011329/39308=16725=16721=17975=18769=18462=18765/m16579932/-/*

  2. 34c1478e237aa77f3577c70cd7739f04?d=mm


    Apr 22, 2019 15:10

    Must be thank for the visit here an join to the play gin rummy online free game many players exited to join it.

  3. 16ac0964d997a183b8239a32f103de6d?d=mm


    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.

  4. Ca6a490d369ec3ef484ce3a734d5c53e?d=mm


    Sep 10, 2018 13:12

    +1.have this issue too.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.