Documentation

Unity Engine

Unity Engine

Work with text

Learn how to work with text in UI Toolkit, including fonts, styles, and text elements.
Read time 2 minutesLast updated a month ago

Text objects are defined by the following attributes of a UI control:
  • The
    text
    attribute of some UI controls, such as Label or TextElement, that sets the display text.
  • The
    value
    attribute of the TextField that accepts the input text, and the
    label
    attribute that sets the display text for TextField.
You can use USS text properties to style text, such as set the font size and color, etc.
You can also add a new font to style text. Convert fonts to font assets before you use them in your project. In addition to USS styling, you can use rich text tags to style certain words in a text string.

Topic

Description

Get started with textLearn how to style text, create fonts, and style with rich text tags and style sheets by examples.
Style text with USSStyle text with USS text properties inline in UXML, a USS file, or directly in UI Builder.
Style text with rich text tagsStyle words between tags in a text string.
Font assetsUnderstand different font assets and all their properties.
Text effectsApply text effects to text elements to enhance the visual appearance of the text.
Style sheet assetsCreate custom text styles to extend the rich text tags.
Use sprites in textCreate sprite assets to interpret emoji characters and include them in text.
Color gradientsCreate color gradients to apply up to four colors for each character in a text string.
Color emojisInclude color glyphs and emojis in text.
Advanced Text GeneratorAdd comprehensive Unicode support and text shaping capabilities to your project.
UITK Text Settings assetsReferenced by a Panel Settings asset and controls the default values for all text objects used within that Panel.
Fallback fontAdd fallback font for missing character in a font asset.

Additional resources