Rounded Rect Mask 2D

screenshot
available on the Asset Store

Documentation

screenshot

Basics

Limitations

Custom Shaders

If you have custom UI shaders and would like them to work with the RoundedRectMask2D component, you will need to edit them, to support the feature. You can check how it's done in the custom Shaders (UI Default & TMP_SDF Mobile).
Here is what you need to do:

  1. Either move your shaders to the AntoineCherel/RoundedRectMask2D/Shaders folder, or copy & paste the RoundedMaskCommon.hlsl library to your custom shader's folder
  2. in the Pass, include the library
    #include "RoundedMaskCommon.hlsl"
  3. in the Vertex to Fragment or Vertext to Pixel struct, add
    float3 posLocal : TEXCOORD8;
  4. fill it in the V2F or V2P function
    OUT.posLocal = v.vertex.xyz;
  5. in the frag or pixel return function, replace the existing clipping method by
    clip( RMUnityUIClipRect(IN.posLocal.xy, _ClipRect, _ClipRectRadii) - 0.5);
    all of these added lines should be encapsulated inside #ifdef UNITY_UI_CLIP_RECT statements.

If something goes wrong double check with the implemented shaders inside the Shaders folder.
You can also reach out to me contact (at) antoinecherel.dev

Credits

Unity Plugin, developped by Antoine Cherel