기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Work with text

Learn how to work with text in UI Toolkit, including fonts, styles, and text elements.
읽는 시간 2분최근 업데이트: 한 달 전

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.
Auto sizing text elementsAutomatically size text elements to fit their content.
Language directionSet the text directionality of a text element to support right-to-left (RTL) languages.
Panel 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.
Create custom text animationUse the
TextElement.PostProcessTextVertices
API to create custom text animation.
Use the legacy Text Core in UI ToolkitEnable and use the legacy Text Core in UI Toolkit.
Migrate static font assets to Advanced Text GeneratorMigrate static font assets to the Advanced Text Generator.

Additional resources