Class TMP_SubMeshUI
Inheritance
Inherited Members
Namespace: TMPro
Assembly: Unity.TextMeshPro.dll
Syntax
[ExecuteAlways]
[RequireComponent(typeof(CanvasRenderer))]
public class TMP_SubMeshUI : MaskableGraphic, ICanvasElement, IClippable, IMaskable, IMaterialModifier
Properties
fallbackMaterial
Fallback material used when the primary font material is unavailable.
Declaration
public Material fallbackMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
fallbackSourceMaterial
The source material used by the fallback font
Declaration
public Material fallbackSourceMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
fontAsset
The TMP Font Asset assigned to this sub text object.
Declaration
public TMP_FontAsset fontAsset { get; set; }
Property Value
| Type | Description |
|---|---|
| TMP_FontAsset |
isDefaultMaterial
Is the text object using the default font asset material.
Declaration
public bool isDefaultMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
mainTexture
Declaration
public override Texture mainTexture { get; }
Property Value
| Type | Description |
|---|---|
| Texture |
Overrides
material
The material to be assigned to this object. Returns an instance of the material.
Declaration
public override Material material { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
materialForRendering
Get the material that will be used for rendering.
Declaration
public override Material materialForRendering { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
mesh
The Mesh of this text sub object.
Declaration
public Mesh mesh { get; set; }
Property Value
| Type | Description |
|---|---|
| Mesh |
padding
Padding value resulting for the property settings on the material.
Declaration
public float padding { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
sharedMaterial
The material to be assigned to this text object.
Declaration
public Material sharedMaterial { get; set; }
Property Value
| Type | Description |
|---|---|
| Material |
spriteAsset
The TMP Sprite Asset assigned to this sub text object.
Declaration
public TMP_SpriteAsset spriteAsset { get; set; }
Property Value
| Type | Description |
|---|---|
| TMP_SpriteAsset |
textComponent
Reference to the parent Text Component.
Declaration
public TMP_Text textComponent { get; }
Property Value
| Type | Description |
|---|---|
| TMP_Text |
Methods
AddSubTextObject(TextMeshProUGUI, MaterialReference)
Function to add a new sub text object.
Declaration
public static TMP_SubMeshUI AddSubTextObject(TextMeshProUGUI textComponent, MaterialReference materialReference)
Parameters
| Type | Name | Description |
|---|---|---|
| TextMeshProUGUI | textComponent | Owning UI text; must not be null. |
| MaterialReference | materialReference | Resolved material slot from the parent text's material index table, including font or sprite asset data. |
Returns
| Type | Description |
|---|---|
| TMP_SubMeshUI | A new TMP_SubMeshUI ready to receive mesh data from the parent text rebuild pipeline. |
Cull(Rect, bool)
Override Cull function as this is handled by the parent text object.
Declaration
public override void Cull(Rect clipRect, bool validRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | clipRect | Canvas-space clip rectangle from the UI clipping pass; ignored here but required for signature compatibility. |
| bool | validRect | True when |
Overrides
GetModifiedMaterial(Material)
Declaration
public override Material GetModifiedMaterial(Material baseMaterial)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | baseMaterial |
Returns
| Type | Description |
|---|---|
| Material |
Overrides
GetPaddingForMaterial()
Function called when the padding value for the material needs to be re-calculated.
Declaration
public float GetPaddingForMaterial()
Returns
| Type | Description |
|---|---|
| float | Uniform padding required to avoid clipping expanded effects for the active shared material. |
GetPaddingForMaterial(Material)
Function called when the padding value for the material needs to be re-calculated.
Declaration
public float GetPaddingForMaterial(Material mat)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | mat | The material to compute padding for. |
Returns
| Type | Description |
|---|---|
| float | Uniform padding in mesh units for |
OnDestroy()
Declaration
protected override void OnDestroy()
Overrides
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnTransformParentChanged()
Declaration
protected override void OnTransformParentChanged()
Overrides
Rebuild(CanvasUpdate)
Applies pending material changes when the canvas reaches the PreRender phase.
Declaration
public override void Rebuild(CanvasUpdate update)
Parameters
| Type | Name | Description |
|---|---|---|
| CanvasUpdate | update | Current CanvasUpdate stage; material refresh runs exclusively for PreRender. |
Overrides
RecalculateClipping()
Method called when the state of a parent changes.
Declaration
public override void RecalculateClipping()
Overrides
RefreshMaterial()
Function to update the material from the parent text object.
Declaration
public void RefreshMaterial()
SetAllDirty()
Declaration
public override void SetAllDirty()
Overrides
SetLayoutDirty()
Suppresses the base rebuild; updates are driven by the parent text component. Use SetLayoutDirty() on the parent to mark it dirty.
Declaration
public override void SetLayoutDirty()
Overrides
SetMaterialDirty()
Declaration
public override void SetMaterialDirty()
Overrides
SetPivotDirty()
Copies the parent TextMeshProUGUI pivot onto this sub-mesh so stacked meshes stay aligned.
Declaration
public void SetPivotDirty()
SetVerticesDirty()
Suppresses the base rebuild; updates are driven by the parent text component. Use SetVerticesDirty() on the parent to mark it dirty.
Declaration
public override void SetVerticesDirty()
Overrides
UpdateGeometry()
Declaration
protected override void UpdateGeometry()
Overrides
UpdateMaterial()
Synchronizes the sub-mesh's material properties (like Cull Mode) with the parent and applies the active rendering material to the CanvasRenderer.
Declaration
protected override void UpdateMaterial()
Overrides
UpdateMeshPadding(bool, bool)
Updates the padding used for layout based on the given options.
Declaration
public void UpdateMeshPadding(bool isExtraPadding, bool isUsingBold)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isExtraPadding | True to include TMP's additional safety padding for SDF effects (matches TMP_Text.enableExtraPadding semantics). |
| bool | isUsingBold | True when bold style increases stroke weight so padding accounts for thicker outlines on the material. |