Back to API Reference
Class

BaseModifier

abstract

Base class for all text modifiers that alter text appearance or behavior.

Remarks

Modifiers are applied to text ranges via markup tags parsed by IParseRule implementations and can modify glyph rendering, colors, animations, or other properties. Lifecycle: SetOwner is called when the modifier is attached to UniText (sets references only) Apply is called for each text range - lazy initialization on first call Disable is called when text changes Destroy is called when the modifier is removed
public bool IsInitialized{ get }

Returns true if this modifier has been initialized (Apply called at least once).

public void Prepare()

Prepares the modifier for a new text cycle. Creates buffers and clears them. Called once before Apply pass.

public void Apply(int start, int end, string parameter)

Applies the modifier to a text range. Requires Prepare() to be called first.

public void SetOwner(UniTextBase uniText)

Sets the owner UniText reference. Does NOT initialize buffers or subscribe to events.

public void Destroy()

Deinitializes the modifier and releases resources.

public void Disable()

Resets the modifier state for new text. Unsubscribes from events - will re-subscribe on next Apply().

public virtual void PrepareForParallel()

Called on the main thread before parallel processing begins. Override to cache values from Unity APIs that are main-thread-only (e.g., Material.GetFloat).

protected virtual void OnEnable()

Subscribes to UniText events. Override to set up buffers and event handlers.

protected virtual void OnDisable()

Unsubscribes from UniText events. Override to remove event handlers.

protected virtual void OnDestroy()

Releases buffers when the modifier is removed. Override to clean up resources.

protected abstract void OnApply(int start, int end, string parameter)

Implements the modifier's effect on the specified range.

public UniTextBase uniText

Reference to the UniText component this modifier is attached to.

protected UniTextBuffers buffers

See Also