Text effects
Apply text effects to text elements to enhance the visual appearance of the text.
읽는 시간 2분최근 업데이트: 21일 전
You can apply text effects to enhance the visual appearance of the text. However, these effects are only supported for font assets with SDF rendering mode and not for bitmap. The range of the text effects is limited by the padding defined for the font asset. Therefore, to increase the size of the effect, you must increase the padding.
You can use text effects to:
- Apply text shadows
- Apply text outlines
Apply text shadows
To apply shadows to the text, set the property in a USS file, inline in UXML, or a C# script.
text-shadowtext-shadow- : Horizontal shadow displacement. Positive values move the shadow to the right, while negative values move it to the left.
text-shadow-offset-x - : Vertical shadow displacement. Positive values move the shadow down, while negative values move it up.
text-shadow-offset-y - : The blur intensity of the shadow. Higher values result in more blur shadows, while 0 creates a sharp shadow.
text-shadow-blur-radius - : The color of the shadow, either as a hex code or in RGBA format.
text-shadow-color
The following example applies a shadow to a element:
Label
Text shadow example
Label { text-shadow: 6.1px -2.4px 0px rgb(144, 31, 32);}
Apply text outlines
To apply outlines to text, set the property in a USS file, inline in UXML, or a C# script.
unity-text-outlineunity-text-outline- : The width of the outline.
-unity-text-outline-width - : The color of the outline, either as a hex code or in RGBA format.
-unity-text-outline-color
The following example applies an outline to a element:
Label
Text outline example
Label { text-outline: 6px rgb(144, 31, 32);}