Class TextMeshPro
Namespace: TMPro
Syntax
public class TextMeshPro : TMP_Text, ILayoutElement
Fields
m_subTextObjects
Declaration
protected TMP_SubMesh[] m_subTextObjects
Field Value
Properties
autoSizeTextContainer
Determines if the size of the text container will be adjusted to fit the text object when it is first created.
Declaration
public override bool autoSizeTextContainer { get; set; }
Property Value
Overrides
maskType
Declaration
public MaskingTypes maskType { get; set; }
Property Value
mesh
Returns the mesh assigned to the text object.
Declaration
public override Mesh mesh { get; }
Property Value
Overrides
meshFilter
Returns the Mesh Filter of the text object.
Declaration
public MeshFilter meshFilter { get; }
Property Value
Type |
Description |
MeshFilter |
|
renderer
Returns the rendered assigned to the text object.
Declaration
public Renderer renderer { get; }
Property Value
Type |
Description |
Renderer |
|
sortingLayerID
Sets the Renderer's sorting Layer ID
Declaration
public int sortingLayerID { get; set; }
Property Value
sortingOrder
Sets the Renderer's sorting order within the assigned layer.
Declaration
public int sortingOrder { get; set; }
Property Value
textContainer
Returns a reference to the Text Container
Declaration
[Obsolete("The TextContainer is now obsolete. Use the RectTransform instead.")]
public TextContainer textContainer { get; }
Property Value
transform
Returns a reference to the Transform
Declaration
public Transform transform { get; }
Property Value
Type |
Description |
Transform |
|
Methods
AdjustLineOffset(Int32, Int32, Single)
Declaration
protected override void AdjustLineOffset(int startIndex, int endIndex, float offset)
Parameters
Overrides
Awake()
Declaration
protected override void Awake()
CalculateLayoutInputHorizontal()
Declaration
public void CalculateLayoutInputHorizontal()
CalculateLayoutInputVertical()
Declaration
public void CalculateLayoutInputVertical()
ClearMesh(Boolean)
Function to clear the geometry of the Primary and Sub Text objects.
Declaration
public override void ClearMesh(bool updateMesh)
Parameters
Type |
Name |
Description |
Boolean |
updateMesh |
|
Overrides
ClearSubMeshObjects()
Declaration
protected override void ClearSubMeshObjects()
Overrides
ComputeMarginSize()
Update the margin width and height
Declaration
public override void ComputeMarginSize()
Overrides
ForceMeshUpdate()
Function to force regeneration of the mesh before its normal process time. This is useful when changes to the text object properties need to be applied immediately.
Declaration
public override void ForceMeshUpdate()
Overrides
ForceMeshUpdate(Boolean)
Function to force regeneration of the mesh before its normal process time. This is useful when changes to the text object properties need to be applied immediately.
Declaration
public override void ForceMeshUpdate(bool ignoreInactive)
Parameters
Type |
Name |
Description |
Boolean |
ignoreInactive |
If set to true, the text object will be regenerated regardless of is active state.
|
Overrides
GenerateTextMesh()
This is the main function that is responsible for creating / displaying the text.
Declaration
protected override void GenerateTextMesh()
Overrides
GetCompoundBounds()
Method returning the compound bounds of the text object and child sub objects.
Declaration
protected override Bounds GetCompoundBounds()
Returns
Overrides
GetMaterial(Material)
Declaration
protected override Material GetMaterial(Material mat)
Parameters
Type |
Name |
Description |
Material |
mat |
|
Returns
Type |
Description |
Material |
|
Overrides
GetMaterials(Material[])
Method returning instances of the materials used by the text object.
Declaration
protected override Material[] GetMaterials(Material[] mats)
Parameters
Type |
Name |
Description |
Material[] |
mats |
|
Returns
Type |
Description |
Material[] |
|
Overrides
GetPaddingForMaterial()
Get the padding value for the currently assigned material.
Declaration
protected override float GetPaddingForMaterial()
Returns
Overrides
GetPaddingForMaterial(Material)
Get the padding value for the currently assigned material.
Declaration
protected override float GetPaddingForMaterial(Material mat)
Parameters
Type |
Name |
Description |
Material |
mat |
|
Returns
Overrides
GetSharedMaterials()
Method returning an array containing the materials used by the text object.
Declaration
protected override Material[] GetSharedMaterials()
Returns
Type |
Description |
Material[] |
|
Overrides
GetTextContainerLocalCorners()
Method to return the local corners of the Text Container or RectTransform.
Declaration
protected override Vector3[] GetTextContainerLocalCorners()
Returns
Type |
Description |
Vector3[] |
|
Overrides
GetTextInfo(String)
Function used to evaluate the length of a text string.
Declaration
public override TMP_TextInfo GetTextInfo(string text)
Parameters
Type |
Name |
Description |
String |
text |
|
Returns
Overrides
LoadFontAsset()
Declaration
protected override void LoadFontAsset()
Overrides
OnDestroy()
Declaration
protected override void OnDestroy()
OnDidApplyAnimationProperties()
Declaration
protected override void OnDidApplyAnimationProperties()
OnDisable()
Declaration
protected override void OnDisable()
OnEnable()
Declaration
protected override void OnEnable()
OnRectTransformDimensionsChange()
Declaration
protected override void OnRectTransformDimensionsChange()
OnTransformParentChanged()
Declaration
protected override void OnTransformParentChanged()
Rebuild(CanvasUpdate)
Declaration
public override void Rebuild(CanvasUpdate update)
Parameters
Type |
Name |
Description |
CanvasUpdate |
update |
|
SetActiveSubMeshes(Boolean)
Method to Enable or Disable child SubMesh objects.
Declaration
protected override void SetActiveSubMeshes(bool state)
Parameters
Type |
Name |
Description |
Boolean |
state |
|
Overrides
SetAllDirty()
Declaration
public override void SetAllDirty()
SetArraySizes(Int32[])
Declaration
protected override int SetArraySizes(int[] chars)
Parameters
Type |
Name |
Description |
Int32[] |
chars |
|
Returns
Overrides
SetCulling()
Declaration
protected override void SetCulling()
Overrides
SetFaceColor(Color32)
Declaration
protected override void SetFaceColor(Color32 color)
Parameters
Type |
Name |
Description |
Color32 |
color |
|
Overrides
SetLayoutDirty()
Declaration
public override void SetLayoutDirty()
SetMask(MaskingTypes, Vector4)
Function used to set the mask type and coordinates in World Space
Declaration
public void SetMask(MaskingTypes type, Vector4 maskCoords)
Parameters
SetMask(MaskingTypes, Vector4, Single, Single)
Function used to set the mask type, coordinates and softness
Declaration
public void SetMask(MaskingTypes type, Vector4 maskCoords, float softnessX, float softnessY)
Parameters
SetMaterialDirty()
Schedule updating of the material used by the text object.
Declaration
public override void SetMaterialDirty()
SetOutlineColor(Color32)
Declaration
protected override void SetOutlineColor(Color32 color)
Parameters
Type |
Name |
Description |
Color32 |
color |
|
Overrides
SetOutlineThickness(Single)
Declaration
protected override void SetOutlineThickness(float thickness)
Parameters
Type |
Name |
Description |
Single |
thickness |
|
Overrides
SetShaderDepth()
Declaration
protected override void SetShaderDepth()
Overrides
SetSharedMaterial(Material)
Declaration
protected override void SetSharedMaterial(Material mat)
Parameters
Type |
Name |
Description |
Material |
mat |
|
Overrides
SetSharedMaterials(Material[])
Method used to assign new materials to the text and sub text objects.
Declaration
protected override void SetSharedMaterials(Material[] materials)
Parameters
Type |
Name |
Description |
Material[] |
materials |
|
Overrides
SetVerticesDirty()
Schedule rebuilding of the text geometry.
Declaration
public override void SetVerticesDirty()
UpdateFontAsset()
Declaration
public void UpdateFontAsset()
UpdateGeometry(Mesh, Int32)
Function to update the geometry of the main and sub text objects.
Declaration
public override void UpdateGeometry(Mesh mesh, int index)
Parameters
Type |
Name |
Description |
Mesh |
mesh |
|
Int32 |
index |
|
Overrides
UpdateMaterial()
Declaration
protected override void UpdateMaterial()
UpdateMeshPadding()
Function to be used to force recomputing of character padding when Shader / Material properties have been changed via script.
Declaration
public override void UpdateMeshPadding()
Overrides
UpdateVertexData()
Function to upload the updated vertex data and renderer.
Declaration
public override void UpdateVertexData()
Overrides
UpdateVertexData(TMP_VertexDataUpdateFlags)
Function to upload the updated vertex data and renderer.
Declaration
public override void UpdateVertexData(TMP_VertexDataUpdateFlags flags)
Parameters
Overrides