TextElement
Use this as the super class if you are declaring a custom VisualElement that displays text. For example, Button or Label use this as their base class. For more information, refer to UXML element TextElement.
Read time 7 minutesLast updated 3 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: BindableElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IVisualElementScheduler, IBindable, INotifyValueChanged<string>, ITextEdition, ITextElementExperimentalFeatures, IExperimentalFeatures, ITextSelection
public class TextElement : BindableElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IVisualElementScheduler, IBindable, INotifyValueChanged<string>, ITextEdition, ITextElementExperimentalFeatures, IExperimentalFeatures, ITextSelection
Static Fields
Value | Description |
|---|---|
| selectableUssClassName | USS class name of selectable text elements. |
| ussClassName | USS class name of elements of this type. |
Constructors
Constructor | Description |
|---|---|
| TextElement() | Initializes and returns an instance of TextElement. |
Properties
Property | Description |
|---|---|
| displayTooltipWhenElided | When true, a tooltip displays the full version of elided text, and also if a tooltip had been previously provided, it will be overwritten. |
| emojiFallbackSupport | Specifies the order in which the system should look for Emoji characters when rendering text. If this setting is enabled, the global Emoji Fallback list will be searched first for characters defined as Emoji in the Unicode 14.0 standard. |
| enableRichText | When false, rich text tags will not be parsed. |
| experimental | Returns the TextElement experimental interface. |
| isElided | Returns true if text is elided, false otherwise. |
| parseEscapeSequences | Determines how escape sequences are displayed. When set to |
| selection | Retrieves this TextElement's ITextSelection |
| text | The text to be displayed. |
Methods
Method | Description |
|---|---|
| MarkDirtyText | Marks that the TextElement forces a layout and repaint. |
| MeasureTextSize | Computes the size needed to display a text string based on element style values such as font, font-size, word-wrap, and so on. |