Docsv3.12.0
Back to API Reference
Class

UniText

Inherits:UniTextBase
Implements:ICanvasClipSourceIClipperILayoutController

Canvas-space text component. Renders into a Canvas via CanvasRenderer with full Unicode support — bidirectional scripts (Arabic, Hebrew), complex shaping (Devanagari, Thai), proper line breaking, color emoji, and a markup system via ParseRule.

Remarks

For world-space text (no Canvas), use UniTextWorld.

Nested Types

public Nullable<Rect> CanvasClipRect{ get }

The text's local viewport clip, independent of ancestor Canvas masks.

public IEnumerable<CanvasRenderer> CanvasRenderers{ get }

Gets all canvas renderers used for sub-meshes.

protected bool RenderRootOffsetsGeometry{ get }
protected bool NeedsFrameTick{ get }
public RectTransform RenderRoot{ get }

Holds glyphs, inline media and range decorations in mesh space, below user-authored children; its position applies the document window offset. Main thread only; creates a hidden GameObject.

protected override void UpdateRendering()
protected override void ClearAllRenderers()
protected override void ApplyVisibility()
protected override float ProjectedEmPixels()

Screen-space canvases resolve the em size from the canvas scale and this transform's scale relative to the canvas; a world-space canvas relies on a camera adapter's projected scale.

protected override bool ApplyWindowScroll()

Re-places the window by moving the render root and the mask stamp root; built meshes stay untouched, except a mask stamp drawn in place, which is rebuilt to move with the content.

protected override void OnSetDirty()
protected override void ResolveViewportBounds()

Supplies the clip rect of the RectMask2D over this text as the viewport and the root canvas rect as the display, both mapped out of root canvas space; neither while this text has no canvas, and an empty viewport while the mask holds no valid rect.

protected override void OnDeInit()
public override void SetMaterialDirty()

Translates Canvas masking notifications into a UniText appearance rebuild.

protected override void OnEnable()
protected override void OnDisable()
protected override void OnCanvasHierarchyChanged()
protected override void OnTransformParentChanged()
public override void CrossFadeColor()
public override void CrossFadeAlpha()
protected override void OnFrameTick()
public override void SetClipRect()

Sets the clipping rectangle for masking, applying to all sub-mesh renderers. Mask removal reaches a clippable only through this call (never Cull), so an invalid rect also resets VisibleWindow and the clip-cull state — otherwise the mesh would stay windowed and culled with no mask to excuse it.

public override void SetClipSoftness()

Sets soft clipping edges for smooth mask transitions on all sub-mesh renderers; a content clip's own softness takes their place while it is set.

public override void Cull()

Culls against the actual rendered mesh bounds rather than the RectTransform (whose corners serve until a mesh exists). Glyphs can extend beyond the rect (long words, overflow, outline/glow, modifier transforms), so the default rect-corner test would hide still-visible meshes.

public override void OnCullingChanged()

Restores the effective cull — the union of clip-culling and render suppression — on every culling change, so a direct cull write from outside never lifts a Hide or scene-visibility state.

public float GetMaxContentWidth()

The widest the text is without wrapping, padding included: its widest line between mandatory breaks.

public float GetMinContentWidth()

The narrowest the text is without splitting a word, padding included: its widest run no break opportunity divides, at the minimum font size when it sizes itself. Without word wrap, its widest line.

public float GetHeightForWidth()

The height the text takes laid out width wide, padding included in both. The measurement is the pass the text runs for its own rect and shares its cache, so a text then given this width lays out without breaking its lines again.

public static bool LanguageMatches()

Matches nonempty BCP 47 tags case-insensitively at subtag boundaries, such as zh and zh-Hans.

protected override Camera ResolveEventCamera()