Back to API Reference
Class

EffectModifier

abstract

Base class for modifiers that render an additional effect pass behind the face (outline, shadow, glow).

Remarks

Lifecycle per frame: onGlyph — subclass OnGlyphEffect calls EnqueueEffectQuad to record a per-glyph request into its own instance buffer. The current value of currentEffectPass is captured into the request, deciding whether the duplicate eventually lands before or after the face. No mesh is written yet. onMainPassFinalize — each EffectModifier applies its queued requests in registration order, appending duplicate quads to the mesh generator's vertex buffer and queueing their triangle indices into the generator's shared pre- or post-face buffer (QueueEffectTriangle) according to the captured pass. After onMainPassFinalize — the generator flushes both shared buffers in one shot: pre-face tris are prepended, post-face tris are inserted at postFaceInsertPoint, producing the final order [pre-face 1..N, face, post-face 1..N, line]. Grouping per modifier (not per glyph) is what gives a consistent painter order when multiple effects overlap across glyph boundaries — outline of glyph N+1 never covers shadow of glyph N, because all outline tris precede all shadow tris.
protected abstract void OnGlyphEffect()

Called for each glyph during mesh generation. Subclass checks cluster ranges and calls EnqueueEffectQuad for matching glyphs. Emoji glyphs must be skipped (uniText.MeshGenerator.font.IsColor).

protected override void OnEnable()
protected override void OnDisable()
protected override void OnDestroy()
protected void EnqueueEffectQuad(int sourceBaseIdx, Vector4 effectUv, float offsetX, float offsetY, float expandDelta)

Queues an effect duplicate for the current glyph. The actual quad append happens later in onMainPassFinalize, grouped per modifier so that all duplicates of this effect are contiguous in the final index buffer. The current value of currentEffectPass is captured into the request and determines whether the duplicate eventually lands before or after the face.

protected virtual void ApplyOwnRequests()

Default per-frame application of queued requests. Subclasses with multi-layer effects (e.g. extrude) may override to flush their own per-layer buffers in render-order rather than the per-glyph order that EnqueueEffectQuad implies.

protected static int AppendSharedEffectQuad()

Appends one duplicate quad to the generator's vertex buffer and queues its triangle indices into the thread-static shared buffer matching pass. Returns the destination vertex index of the new quad's first vertex (use it with ExpandQuad).