BaseModifier
Base class for logic that alters the appearance, layout, semantics, or behavior of ranges emitted by a RangeSource.
Remarks
OnEnable, OnDisable, OnDestroy, OnApply, optionally PrepareForParallel). Lifecycle dispatching is driven by the framework (Style, the parse pipeline, CompositeModifier) — user code instantiates modifiers and hands them to Style; it should not invoke the lifecycle itself. Cycle (per parse pass on a UniText component): OnEnable runs once when the modifier first participates in a cycle — allocate pooled buffers and subscribe to UniText events here. OnApply runs for every tag/range matched in the current text. OnDisable runs at the start of the next cycle to unsubscribe event handlers; allocated buffers should stay alive so the next OnEnable can reuse them. OnDestroy runs when the modifier is removed from the component (style changed, font reload, component destroyed) — release pooled buffers and any other resources OnEnable acquired. Guaranteed to run exactly once per OnEnable-initiated resource acquisition, even when an intervening OnDisable has already cleared the subscription state. Granular reapplication re-runs OnApply over retained spans without a re-parse, once per span — so accumulators OnApply appends to must be cleared once per cycle, never at the start of OnApply itself. Override BeforeApply for that: the framework compares the host's apply-cycle stamp on each dispatch and calls it lazily before the modifier's first range of a new cycle (full parse and granular re-apply alike). There is no separate reset phase.Derived Types(30)
Types that inherit from BaseModifier.
public RangeQuery Ranges()Starts a query over this modifier's materialized ranges; chain filters, then materialize with Collect or take standing ownership with Own<TModifier,TValue>.
public OwnedParameterSet<TModifier,TValue> Own()Takes standing ownership of one parameter across every range of this modifier, now and after every future parse.
Runs once per apply cycle (full parse and granular re-apply alike), lazily before this modifier's first OnApply of the cycle. Bring accumulated state back to a valid start: clear buffers OnApply appends to (ranges?.FakeClear()), release externally held resources the re-run re-acquires (gradient ramp rows), restore derived flags. A granular re-apply replays the cycle inside the mesh phase without re-running the parse, shaping, or — while positions stay valid — layout, so state whose only producer is one of those phases must never be cleared or overwritten here and belongs in a container this method does not touch. Runs on the rebuild worker — keep it idempotent and free of Unity API calls. Overwrite-style attribute buffers need nothing here.
protected virtual void OnApply(RangeApplyContext context)Applies this modifier to one entity segment. Override this hook to access identity, payload, source, revision and layered parameters without materializing a merged value.
protected UniTextBase uniTextThe UniText component this modifier is bound to. Assigned by the framework via SetOwner; available to subclasses from OnEnable onward.
protected UniTextBuffers buffersShared text-processing buffers (codepoints, runs, shaped glyphs, attribute storage). Assigned by the framework alongside uniText.
