Back to API Reference
Class
MaterialModifier
Inherits:SubMeshModifier
Implements:IModifierCommitChanges
Applies a user-authored Material to a text range by emitting a dedicated sub-mesh with its own CanvasRenderer.
Remarks
The custom shader must include UniText_Custom.cginc — see Assets/Create/UniText/Custom Material Shader for a working template. The glyph atlases are global shader bindings and must NOT appear in the shader's Properties block; per-glyph user data is written into TEXCOORD2 / TEXCOORD3 (see
constantUv2, constantUv3, glyphDataWriter and OnWriteGlyphUV). Default renderOrder is Replace: the base pass is suppressed on the range (the face quad is claimed and not recorded into the main mesh). Use Keep to keep the base pass and stack the custom material as its own layer, ordered by this modifier's position in Styles. Parameter: optional tint color. Format: <mat=#RRGGBBAA> or <mat=red>. The tint multiplies the vertex color that the shader receives. Replace suppresses the base face structurally: the glyph's base quad is not recorded, so the result is independent of where the modifier sits among other Styles. Paint layers (stroke, shadow, glow) are separate quads at their own sequence and still render over/under it. Emoji glyphs are handled identically to text — the unified vertex-mode contract lets the one custom material render every glyph mode.Nested Types
protected override Material GetMaterial()