Scripting API

TextGenerator

class in UnityEngine · UnityEngine.TextRenderingModule

21 of 22 of Unity's membersUnity's documentation
In Tassix

Lays text out in a rect: rich text runs, word wrapping (breaking words that don't fit a line on their own), alignment, line spacing, truncation and best fit. Produces a quad per visible glyph in pixels, relative to the rect's pivot, plus character and line info.
Layout follows the font's whole-pixel metrics: each advance is rounded, kerning shifts a glyph (after its cursor position is taken), a line steps down by the font's line height, and a line's baseline sits its rounded ascent below its top.

Constructors 1

TextGenerator()
TextGenerator(int initialCapacity)

Properties 9

int characterCount { get; }
int characterCountVisible { get; }
IList<UICharInfo> characters { get; }
int fontSizeUsedForBestFit { get; }
int lineCount { get; }
IList<UILineInfo> lines { get; }
Rect rectExtents { get; }
int vertexCount { get; }
IList<UIVertex> verts { get; }

Methods 12

void Dispose()
void GetCharacters(List<UICharInfo> characters)
UICharInfo[] GetCharactersArray()
void GetLines(List<UILineInfo> lines)
UILineInfo[] GetLinesArray()
float GetPreferredHeight(string str, TextGenerationSettings settings)
float GetPreferredWidth(string str, TextGenerationSettings settings)
void GetVertices(List<UIVertex> vertices)
UIVertex[] GetVerticesArray()
void Invalidate()
bool Populate(string str, TextGenerationSettings settings)

Lays the text out (again only when the text or settings changed).

bool PopulateWithErrors(string str, TextGenerationSettings settings, GameObject context)

Not in Tassix yet 1

Finalize

Checked against Unity

Conformance scenarios that exercise it, recorded in Unity and compared event by event.