RectMask2D Softness Question for Unity Devs

Why is the Softness value in RectMask2D a Vector2Int instead of a Vector4? My team would use RectMask2D for a lot more things if Softness could be set discreetly per side.

Most common example: Fading the bottom of a vertical scroll view about 150px and the top only about 20px. Currently we have to do this using a 3rd party plugin called SoftMask, which has been problematic due to mixing mask types.

Maybe a Softness Offset feature could be introduced additively, which wouldn’t disrupt existing Inspector data for everyone? I already looked into inheriting from RectMask2D and simply using a custom editor to display discreet fields in the inspector, but there are some core scripts that I would need to edit to make it work.

4 Likes

We’d love this too.

To drive this even further, we would likely programmatically update these values based on the position of the scroll content. For instance: if the scroll content isn’t off one edge, we would turn off the softness, and fade the softness in as the user scrolls content in one direction or another.

1 Like

Hi, I’m having the same issue to be fairly honests. I was trying to make a marquee text for TMP.
I’ve came up with very complex solutions but they still have limits.

I’m using Unity 2023.2.14f (.20f now)

I tried expanding programmatically the RectMask2D and adding a certain offset to the TMP UGUI gameobject inside of the rect mask2D depending on the softness so the text does not get blurred on the left.
Sadly, the way the rect mask computes the amount of softness is not using pixels but a ratio (it seems) and I did not bother doing that in the end as it was too complex. At this moment, my marquee component caused errors at build-time only with Unity TMP canvases masking rebuilding system, so I just gave up.

I guess I’ll try something else using shaders maybe ?
In any case, this is very annoying not to have a by-side softness value. I hope a Unity dev will maybe address this issue or someone will come up with a better solution.