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
public Material Material{ get; set }Custom material applied to this modifier's ranges.
public MaterialRenderOrder RenderOrder{ get; set }How the custom material composes with the base text pass.
public Vector4 ConstantUv2{ get; set }Constant TEXCOORD2 value written to every glyph vertex.
public Vector4 ConstantUv3{ get; set }Constant TEXCOORD3 value written to every glyph vertex.
public Color32 Tint{ get; set }Color multiplied into vertices emitted for this modifier.
protected override Material GetMaterial()