SpriteRenderer components have the option to show the sprite only when it’s inside a spritemask, but I cannot find this option for text components. Is there any method to accomplish this?
You can use a RectMask2D! As long as the parent to your TMPro has this component, it will automatically mask away everything not inside its width and height.