Back to API Reference
Struct

TextPaint

sealed

A resolved paint — flat colour, gradient, or texture — shared by every paint consumer. Built per application from a parameter token (Resolve); it is a runtime value, never a serialized field on a modifier. Invariant: projection fields carry only resolved values — never Inherit/NaN — so emitters and the shader contract read them without sentinel checks.

public static TextPaint Solid()

Creates a runtime solid paint with the engine-default projection.

public static TextPaint Resolve()

Resolves one paint token: a swatch name (via swatches) carrying the paint appearance (kind/colour/gradient/texture) and its full projection (the base layer of the override hierarchy — see ApplyProjection), or a colour literal (#RRGGBBAA / named) → solid with engine-default projection. The name is tried first unless the token is an explicit # hex; an unresolved token falls back to opaque white. Touches no Unity APIs (worker-thread safe); texture pixel dimensions are filled separately on the main thread.

public static TextPaint Resolve()

Resolves an authored PaintRef by its explicit kind — a colour literal, a named swatch (via swatches), or opaque white for the default (the layer swaps in its own default colour afterward).

public void ApplyProjection()

The single projection-override resolve: layers a modifier's serialized fields and the remaining per-range tokens of reader over the values this paint already carries from its swatch (or the engine defaults for a colour literal). Per field, strongest wins: tag/default-parameter token → modifier field → swatch. Inherit enum members and NaN floats/axes mean "no value at that layer"; a non-positive resolved scale normalizes to 1.

public void ApplyProjection()

Applies already-resolved projection overrides, strongest layer last: a non-sentinel value replaces what this paint carries from its swatch; Inherit enum members and NaN floats/axes keep the swatch value. A non-positive scale normalizes to 1.

public void ApplyProjectionDetails()

Applies already-resolved non-mapping projection overrides under the same sentinel contract as ApplyProjection — for consumers whose mapping vocabulary differs from PaintMapping and is resolved separately.

public void ApplyBlend()

Applies the modifier/default/tag blend override, retaining the swatch mode when inherited.

public void ApplySpread()

Applies the spread override, retaining the swatch value when inherited. Occupies the final slot of its consumer's positional parameter list: call it after every other parameter that consumer reads, since slot positions are part of the authored contract.

public PaintSourceKind kind

Resolved solid, gradient, or texture source kind.

public Color32 color

Resolved solid colour or tint multiplied with the sampled source.

public Gradient gradient

Resolved gradient payload when kind is Gradient.

public PaintProjectionKind shape

Resolved geometric projection kind.

public Texture2D texture

Resolved texture when kind is Texture.

public PaintMapping mapping

Text bounds used as the projection frame.

public PaintFit fit

Resolved texture fitting policy.

public PaintSpread spread

Resolved gradient continuation outside the projection frame.

public float angle

Resolved projection rotation in degrees.

public float scale

Resolved projection zoom or texture repeat count.

public Vector2 offset

Resolved normalized projection-origin offset.

public LayerBlend blend

Resolved compositing mode.

public int texWidth

Texture pixel dimensions, populated on the main thread before parallel layout; consumed by worker-thread aspect-fit.

public int texHeight

Texture pixel dimensions, populated on the main thread before parallel layout; consumed by worker-thread aspect-fit.