Back to API Reference
Class
SubMeshModifier
abstract
Inherits:BaseModifier
Implements:ILayer
Base class for modifiers that emit a separate, owner-controlled sub-mesh rendered by its own CanvasRenderer with a user-supplied material (see MaterialModifier).
Remarks
Lifecycle per frame: onRebuildStart — own buffers are cleared; any persistent state (e.g. Replace-mode claim of the base face) will be re-applied in the next onGlyph pass. The geometry-consumer tail of onGlyph — subclass overrides
ShouldIncludeCurrentGlyph and, when true, the base class copies the completed face quad (4 verts) from the generator into its own buffer. SDF, MSDF and emoji glyphs share it — the per-glyph mode rides the vertex stream (UV1.w), so one material renders them all. onCollectSubMeshes — the base class appends one entry to the render-data list, with the material, order and sort index chosen by the subclass. Compared to EffectModifier, which bakes its duplicates into the same mesh as the face pass, SubMeshModifier keeps its vertices in isolated local buffers because each sub-mesh is bound to a distinct material and CanvasRenderer.Derived Types(1)
Types that inherit from SubMeshModifier.
protected abstract Material GetMaterial()Resolves the sub-mesh material. Return to skip emitting.
protected virtual void OnQuadAppended(int vertexStart, UniTextMeshGenerator gen)Called after a glyph's quad is copied into the sub-mesh buffer. Override to write custom UV2/UV3 data for the just-appended four vertices, or to modify colors/positions. The four vertices occupy indices [vertexStart, vertexStart + 4).
protected Color32[] GetSubMeshColors()Direct access to the sub-mesh color buffer for read/write on already-appended vertices.
protected Vector3[] GetSubMeshVertices()Direct access to the sub-mesh vertex buffer for read/write on already-appended vertices.
