Class TMP_Text
Base class which contains common properties and functions shared between the TextMeshPro and TextMeshProUGUI component.
Inherited Members
UnityEngine.UI.MaskableGraphic.OnValidate()
UnityEngine.UI.MaskableGraphic.UnityEngine.UI.IClippable.get_gameObject()
UnityEngine.UI.Graphic.SetRaycastDirty()
UnityEngine.UI.Graphic.OnRebuildRequested()
UnityEngine.UI.Graphic.Reset()
UnityEngine.UI.Graphic.UnityEngine.UI.ICanvasElement.get_transform()
Namespace: TMPro
Syntax
public abstract class TMP_Text : MaskableGraphic, ICanvasElement, IClippable, IMaskable, IMaterialModifier
Fields
checkPaddingRequired
Declaration
[SerializeField]
protected bool checkPaddingRequired
Field Value
isMaskUpdateRequired
Declaration
protected bool isMaskUpdateRequired
Field Value
k_LargeNegativeFloat
Declaration
protected static float k_LargeNegativeFloat
Field Value
k_LargeNegativeInt
Declaration
protected static int k_LargeNegativeInt
Field Value
k_LargeNegativeVector2
Declaration
protected static Vector2 k_LargeNegativeVector2
Field Value
k_LargePositiveFloat
Declaration
protected static float k_LargePositiveFloat
Field Value
k_LargePositiveInt
Declaration
protected static int k_LargePositiveInt
Field Value
k_LargePositiveVector2
Declaration
protected static Vector2 k_LargePositiveVector2
Field Value
m_actionStack
Declaration
protected TMP_TextProcessingStack<int> m_actionStack
Field Value
m_ActiveFontFeatures
Declaration
[SerializeField]
protected List<OTL_FeatureTag> m_ActiveFontFeatures
Field Value
m_AutoSizeIterationCount
Declaration
protected int m_AutoSizeIterationCount
Field Value
m_AutoSizeMaxIterationCount
Declaration
protected int m_AutoSizeMaxIterationCount
Field Value
m_autoSizeTextContainer
Declaration
protected bool m_autoSizeTextContainer
Field Value
m_baselineOffset
Declaration
protected float m_baselineOffset
Field Value
m_baselineOffsetStack
Declaration
protected TMP_TextProcessingStack<float> m_baselineOffsetStack
Field Value
m_cached_TextElement
Declaration
protected TextElement m_cached_TextElement
Field Value
Type |
Description |
UnityEngine.TextCore.Text.TextElement |
|
m_characterCount
Declaration
protected int m_characterCount
Field Value
m_characterSpacing
Declaration
[SerializeField]
protected float m_characterSpacing
Field Value
m_charWidthAdjDelta
Declaration
protected float m_charWidthAdjDelta
Field Value
m_charWidthMaxAdj
Declaration
[SerializeField]
protected float m_charWidthMaxAdj
Field Value
m_colorGradientPreset
Declaration
protected TextColorGradient m_colorGradientPreset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.TextColorGradient |
|
m_colorGradientPresetIsTinted
Declaration
protected bool m_colorGradientPresetIsTinted
Field Value
m_colorGradientStack
Declaration
protected TMP_TextProcessingStack<TextColorGradient> m_colorGradientStack
Field Value
m_colorMode
Declaration
[SerializeField]
protected ColorGradientMode m_colorMode
Field Value
Type |
Description |
UnityEngine.TextCore.Text.ColorGradientMode |
|
m_colorStack
Declaration
protected TMP_TextProcessingStack<Color32> m_colorStack
Field Value
m_cSpacing
Declaration
protected float m_cSpacing
Field Value
m_currentFontAsset
Declaration
protected FontAsset m_currentFontAsset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.FontAsset |
|
m_currentFontSize
Declaration
protected float m_currentFontSize
Field Value
m_currentMaterial
Declaration
protected Material m_currentMaterial
Field Value
m_currentMaterialIndex
Declaration
protected int m_currentMaterialIndex
Field Value
m_currentSpriteAsset
Declaration
protected SpriteAsset m_currentSpriteAsset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.SpriteAsset |
|
m_defaultSpriteAsset
Declaration
protected SpriteAsset m_defaultSpriteAsset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.SpriteAsset |
|
m_duoSpace
Declaration
protected bool m_duoSpace
Field Value
m_ElementAscender
Declaration
protected float m_ElementAscender
Field Value
m_ElementDescender
Declaration
protected float m_ElementDescender
Field Value
m_Ellipsis
Declaration
protected TMP_Text.SpecialCharacter m_Ellipsis
Field Value
m_enableAutoSizing
Declaration
[SerializeField]
protected bool m_enableAutoSizing
Field Value
Declaration
[SerializeField]
protected bool m_enableExtraPadding
Field Value
m_enableKerning
Declaration
[SerializeField]
protected bool m_enableKerning
Field Value
m_enableVertexGradient
Declaration
[SerializeField]
protected bool m_enableVertexGradient
Field Value
m_faceColor
Declaration
[SerializeField]
protected Color32 m_faceColor
Field Value
m_firstCharacterOfLine
Declaration
protected int m_firstCharacterOfLine
Field Value
m_firstOverflowCharacterIndex
Declaration
protected int m_firstOverflowCharacterIndex
Field Value
m_firstVisibleCharacter
Declaration
protected int m_firstVisibleCharacter
Field Value
m_firstVisibleCharacterOfLine
Declaration
protected int m_firstVisibleCharacterOfLine
Field Value
m_flexibleHeight
Declaration
protected float m_flexibleHeight
Field Value
m_flexibleWidth
Declaration
protected float m_flexibleWidth
Field Value
m_fontAsset
Declaration
[SerializeField]
protected FontAsset m_fontAsset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.FontAsset |
|
m_fontColor
Declaration
[SerializeField]
protected Color m_fontColor
Field Value
m_fontColor32
Declaration
[SerializeField]
protected Color32 m_fontColor32
Field Value
m_fontColorGradient
Declaration
[SerializeField]
protected VertexGradient m_fontColorGradient
Field Value
m_fontColorGradientPreset
Declaration
[SerializeField]
protected TextColorGradient m_fontColorGradientPreset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.TextColorGradient |
|
m_fontMaterial
Declaration
[SerializeField]
protected Material m_fontMaterial
Field Value
m_fontMaterials
Declaration
[SerializeField]
protected Material[] m_fontMaterials
Field Value
m_fontScaleMultiplier
Declaration
protected float m_fontScaleMultiplier
Field Value
m_fontSharedMaterials
Declaration
[SerializeField]
protected Material[] m_fontSharedMaterials
Field Value
m_fontSize
Declaration
[SerializeField]
protected float m_fontSize
Field Value
m_fontSizeBase
Declaration
[SerializeField]
protected float m_fontSizeBase
Field Value
m_fontSizeMax
Declaration
[SerializeField]
protected float m_fontSizeMax
Field Value
m_fontSizeMin
Declaration
[SerializeField]
protected float m_fontSizeMin
Field Value
m_fontStyle
Declaration
[SerializeField]
protected FontStyles m_fontStyle
Field Value
m_FontStyleInternal
Declaration
protected FontStyles m_FontStyleInternal
Field Value
m_fontStyleStack
Declaration
protected TMP_FontStyleStack m_fontStyleStack
Field Value
m_fontWeight
Declaration
[SerializeField]
protected FontWeight m_fontWeight
Field Value
m_FontWeightInternal
Declaration
protected FontWeight m_FontWeightInternal
Field Value
m_FontWeightStack
Declaration
protected TMP_TextProcessingStack<FontWeight> m_FontWeightStack
Field Value
m_FXRotation
Declaration
protected Quaternion m_FXRotation
Field Value
m_FXScale
Declaration
protected Vector3 m_FXScale
Field Value
m_geometrySortingOrder
Declaration
[SerializeField]
protected VertexSortingOrder m_geometrySortingOrder
Field Value
m_havePropertiesChanged
Declaration
protected bool m_havePropertiesChanged
Field Value
m_HighlightStateStack
Declaration
protected TMP_TextProcessingStack<HighlightState> m_HighlightStateStack
Field Value
m_HorizontalAlignment
Declaration
[SerializeField]
protected HorizontalAlignmentOptions m_HorizontalAlignment
Field Value
m_horizontalMapping
Declaration
[SerializeField]
protected TextureMappingOptions m_horizontalMapping
Field Value
m_htmlColor
Declaration
protected Color32 m_htmlColor
Field Value
m_ignoreActiveState
Declaration
protected bool m_ignoreActiveState
Field Value
m_ignoreCulling
Declaration
protected bool m_ignoreCulling
Field Value
m_indentStack
Declaration
protected TMP_TextProcessingStack<float> m_indentStack
Field Value
m_IsAutoSizePointSizeSet
Declaration
protected bool m_IsAutoSizePointSizeSet
Field Value
m_isAwake
Declaration
Field Value
m_isCalculatingPreferredValues
Declaration
protected bool m_isCalculatingPreferredValues
Field Value
m_isCharacterWrappingEnabled
Declaration
protected bool m_isCharacterWrappingEnabled
Field Value
m_isCullingEnabled
Declaration
[SerializeField]
protected bool m_isCullingEnabled
Field Value
m_IsDrivenLineSpacing
Declaration
protected bool m_IsDrivenLineSpacing
Field Value
m_isIgnoringAlignment
Declaration
protected bool m_isIgnoringAlignment
Field Value
m_isLayoutDirty
Declaration
protected bool m_isLayoutDirty
Field Value
m_isMaskingEnabled
Declaration
protected bool m_isMaskingEnabled
Field Value
m_isMaterialDirty
Declaration
protected bool m_isMaterialDirty
Field Value
m_isNewPage
Declaration
protected bool m_isNewPage
Field Value
m_isNonBreakingSpace
Declaration
protected bool m_isNonBreakingSpace
Field Value
m_isOrthographic
Declaration
[SerializeField]
protected bool m_isOrthographic
Field Value
m_isOverlay
Declaration
protected bool m_isOverlay
Field Value
m_isPreferredHeightDirty
Declaration
protected bool m_isPreferredHeightDirty
Field Value
m_isPreferredWidthDirty
Declaration
protected bool m_isPreferredWidthDirty
Field Value
m_isRichText
Declaration
[SerializeField]
protected bool m_isRichText
Field Value
m_isRightToLeft
Declaration
[SerializeField]
protected bool m_isRightToLeft
Field Value
m_isSDFShader
Declaration
protected bool m_isSDFShader
Field Value
m_isTextLayoutPhase
Declaration
protected bool m_isTextLayoutPhase
Field Value
m_IsTextObjectScaleStatic
Declaration
[SerializeField]
protected bool m_IsTextObjectScaleStatic
Field Value
m_isTextTruncated
Declaration
protected bool m_isTextTruncated
Field Value
m_isUsingBold
Declaration
protected bool m_isUsingBold
Field Value
m_isUsingLegacyAnimationComponent
Declaration
[SerializeField]
protected bool m_isUsingLegacyAnimationComponent
Field Value
m_isVolumetricText
Declaration
[SerializeField]
protected bool m_isVolumetricText
Field Value
m_ItalicAngle
Declaration
protected int m_ItalicAngle
Field Value
m_ItalicAngleStack
Declaration
protected TMP_TextProcessingStack<int> m_ItalicAngleStack
Field Value
m_LastBaseGlyphIndex
Declaration
protected int m_LastBaseGlyphIndex
Field Value
m_lastCharacterOfLine
Declaration
protected int m_lastCharacterOfLine
Field Value
m_lastVisibleCharacterOfLine
Declaration
protected int m_lastVisibleCharacterOfLine
Field Value
m_LayoutElement
Declaration
protected LayoutElement m_LayoutElement
Field Value
m_layoutPriority
Declaration
protected int m_layoutPriority
Field Value
m_lineHeight
Declaration
protected float m_lineHeight
Field Value
m_lineJustification
Declaration
protected HorizontalAlignmentOptions m_lineJustification
Field Value
m_lineJustificationStack
Declaration
protected TMP_TextProcessingStack<HorizontalAlignmentOptions> m_lineJustificationStack
Field Value
m_lineNumber
Declaration
protected int m_lineNumber
Field Value
m_lineOffset
Declaration
protected float m_lineOffset
Field Value
m_lineSpacing
Declaration
[SerializeField]
protected float m_lineSpacing
Field Value
m_lineSpacingDelta
Declaration
protected float m_lineSpacingDelta
Field Value
m_lineSpacingMax
Declaration
[SerializeField]
protected float m_lineSpacingMax
Field Value
m_lineVisibleCharacterCount
Declaration
protected int m_lineVisibleCharacterCount
Field Value
m_lineVisibleSpaceCount
Declaration
protected int m_lineVisibleSpaceCount
Field Value
m_linkedTextComponent
Declaration
[SerializeField]
protected TMP_Text m_linkedTextComponent
Field Value
m_margin
Declaration
[SerializeField]
protected Vector4 m_margin
Field Value
m_marginHeight
Declaration
protected float m_marginHeight
Field Value
m_marginLeft
Declaration
protected float m_marginLeft
Field Value
m_marginRight
Declaration
protected float m_marginRight
Field Value
m_marginWidth
Declaration
protected float m_marginWidth
Field Value
m_materialReferenceIndexLookup
Declaration
protected static Dictionary<int, int> m_materialReferenceIndexLookup
Field Value
m_materialReferences
Declaration
protected static MaterialReference[] m_materialReferences
Field Value
m_materialReferenceStack
Declaration
protected static TMP_TextProcessingStack<MaterialReference> m_materialReferenceStack
Field Value
m_maxCapHeight
Declaration
protected float m_maxCapHeight
Field Value
m_maxFontSize
Declaration
protected float m_maxFontSize
Field Value
m_maxHeight
Declaration
protected float m_maxHeight
Field Value
m_maxLineAscender
Declaration
protected float m_maxLineAscender
Field Value
m_maxLineDescender
Declaration
protected float m_maxLineDescender
Field Value
m_maxTextAscender
Declaration
protected float m_maxTextAscender
Field Value
m_maxVisibleCharacters
Declaration
protected int m_maxVisibleCharacters
Field Value
m_maxVisibleLines
Declaration
protected int m_maxVisibleLines
Field Value
m_maxVisibleWords
Declaration
protected int m_maxVisibleWords
Field Value
m_maxWidth
Declaration
protected float m_maxWidth
Field Value
m_mesh
Declaration
Field Value
m_meshExtents
Declaration
protected Extents m_meshExtents
Field Value
m_minFontSize
Declaration
protected float m_minFontSize
Field Value
m_minHeight
Declaration
protected float m_minHeight
Field Value
m_minWidth
Declaration
protected float m_minWidth
Field Value
m_monoSpacing
Declaration
protected float m_monoSpacing
Field Value
m_outlineColor
Declaration
protected Color32 m_outlineColor
Field Value
m_outlineWidth
Declaration
protected float m_outlineWidth
Field Value
m_overflowMode
Declaration
[SerializeField]
protected TextOverflowModes m_overflowMode
Field Value
m_overrideHtmlColors
Declaration
[SerializeField]
protected bool m_overrideHtmlColors
Field Value
m_padding
Declaration
protected float m_padding
Field Value
m_PageAscender
Declaration
protected float m_PageAscender
Field Value
m_pageNumber
Declaration
protected int m_pageNumber
Field Value
m_pageToDisplay
Declaration
[SerializeField]
protected int m_pageToDisplay
Field Value
m_paragraphSpacing
Declaration
[SerializeField]
protected float m_paragraphSpacing
Field Value
m_parseCtrlCharacters
Declaration
[SerializeField]
protected bool m_parseCtrlCharacters
Field Value
m_preferredHeight
Declaration
protected float m_preferredHeight
Field Value
m_preferredWidth
Declaration
protected float m_preferredWidth
Field Value
m_PreviousPivotPosition
Used to track potential changes in pivot position to allow us to ignore OnRectTransformDimensionsChange getting called due to rounding errors when using Stretch Anchors.
Declaration
protected Vector2 m_PreviousPivotPosition
Field Value
m_PreviousRectTransformSize
Used to track potential changes in RectTransform size to allow us to ignore OnRectTransformDimensionsChange getting called due to rounding errors when using Stretch Anchors.
Declaration
protected Vector2 m_PreviousRectTransformSize
Field Value
m_rectTransform
Declaration
protected RectTransform m_rectTransform
Field Value
m_RenderedHeight
Declaration
protected float m_RenderedHeight
Field Value
m_RenderedWidth
Declaration
protected float m_RenderedWidth
Field Value
m_renderMode
Declaration
protected TextRenderFlags m_renderMode
Field Value
m_sharedMaterial
Declaration
[SerializeField]
protected Material m_sharedMaterial
Field Value
m_sizeStack
Declaration
protected TMP_TextProcessingStack<float> m_sizeStack
Field Value
m_spacing
Declaration
protected float m_spacing
Field Value
m_spriteAnimationID
Declaration
protected int m_spriteAnimationID
Field Value
m_spriteAnimator
Declaration
protected TMP_SpriteAnimator m_spriteAnimator
Field Value
m_spriteAsset
Declaration
[SerializeField]
protected SpriteAsset m_spriteAsset
Field Value
Type |
Description |
UnityEngine.TextCore.Text.SpriteAsset |
|
m_spriteColor
Declaration
protected Color32 m_spriteColor
Field Value
m_spriteCount
Declaration
protected int m_spriteCount
Field Value
m_spriteIndex
Declaration
protected int m_spriteIndex
Field Value
m_startOfLineAscender
Declaration
protected float m_startOfLineAscender
Field Value
m_startOfLineDescender
Declaration
protected float m_startOfLineDescender
Field Value
m_strikethroughColor
Declaration
protected Color32 m_strikethroughColor
Field Value
m_strikethroughColorStack
Declaration
protected TMP_TextProcessingStack<Color32> m_strikethroughColorStack
Field Value
m_StyleSheet
Declaration
[SerializeField]
protected TextStyleSheet m_StyleSheet
Field Value
Type |
Description |
UnityEngine.TextCore.Text.TextStyleSheet |
|
m_tabSpacing
Declaration
protected float m_tabSpacing
Field Value
m_text
Declaration
[SerializeField]
[TextArea(5, 10)]
protected string m_text
Field Value
m_textAlignment
Declaration
[SerializeField]
[FormerlySerializedAs("m_lineJustification")]
protected TextAlignmentOptions m_textAlignment
Field Value
m_textContainerLocalCorners
Declaration
protected Vector3[] m_textContainerLocalCorners
Field Value
m_textElementType
Declaration
protected TMP_TextElementType m_textElementType
Field Value
m_textInfo
Declaration
protected TMP_TextInfo m_textInfo
Field Value
m_TextPreprocessor
Declaration
[SerializeField]
protected ITextPreprocessor m_TextPreprocessor
Field Value
m_TextStyleHashCode
Declaration
[SerializeField]
protected int m_TextStyleHashCode
Field Value
m_TextStyleStackDepth
Declaration
protected int m_TextStyleStackDepth
Field Value
m_TextStyleStacks
Declaration
protected TMP_TextProcessingStack<int>[] m_TextStyleStacks
Field Value
m_TextWrappingMode
Declaration
[SerializeField]
[FormerlySerializedAs("m_enableWordWrapping")]
protected TextWrappingModes m_TextWrappingMode
Field Value
m_tintAllSprites
Declaration
[SerializeField]
protected bool m_tintAllSprites
Field Value
m_tintSprite
Declaration
protected bool m_tintSprite
Field Value
m_totalCharacterCount
Declaration
protected int m_totalCharacterCount
Field Value
m_transform
Declaration
protected Transform m_transform
Field Value
m_Underline
Declaration
protected TMP_Text.SpecialCharacter m_Underline
Field Value
m_underlineColor
Declaration
protected Color32 m_underlineColor
Field Value
m_underlineColorStack
Declaration
protected TMP_TextProcessingStack<Color32> m_underlineColorStack
Field Value
m_useMaxVisibleDescender
Declaration
[SerializeField]
protected bool m_useMaxVisibleDescender
Field Value
m_uvLineOffset
Declaration
[SerializeField]
protected float m_uvLineOffset
Field Value
m_VertexBufferAutoSizeReduction
Declaration
[SerializeField]
protected bool m_VertexBufferAutoSizeReduction
Field Value
m_VerticalAlignment
Declaration
[SerializeField]
protected VerticalAlignmentOptions m_VerticalAlignment
Field Value
m_verticalMapping
Declaration
[SerializeField]
protected TextureMappingOptions m_verticalMapping
Field Value
m_width
Declaration
Field Value
m_wordSpacing
Declaration
[SerializeField]
protected float m_wordSpacing
Field Value
m_wordWrappingRatios
Declaration
[SerializeField]
protected float m_wordWrappingRatios
Field Value
m_xAdvance
Declaration
protected float m_xAdvance
Field Value
s_colorWhite
Declaration
protected static Color32 s_colorWhite
Field Value
tag_Indent
Declaration
protected float tag_Indent
Field Value
tag_LineIndent
Declaration
protected float tag_LineIndent
Field Value
tag_NoParsing
Declaration
protected bool tag_NoParsing
Field Value
Properties
alignment
Declaration
public TextAlignmentOptions alignment { get; set; }
Property Value
alpha
Sets the vertex color alpha value.
Declaration
public float alpha { get; set; }
Property Value
autoSizeTextContainer
Enables control over setting the size of the text container to match the text object.
Declaration
public virtual bool autoSizeTextContainer { get; set; }
Property Value
bounds
Returns the bounds of the mesh of the text object in world space.
Declaration
public Bounds bounds { get; }
Property Value
characterSpacing
The amount of additional spacing between characters.
Declaration
public float characterSpacing { get; set; }
Property Value
characterWidthAdjustment
Percentage the width of characters can be adjusted before text auto-sizing begins to reduce the point size.
Declaration
public float characterWidthAdjustment { get; set; }
Property Value
color
This is the default vertex color assigned to each vertices. Color tags will override vertex colors unless the overrideColorTags is set.
Declaration
public override Color color { get; set; }
Property Value
Overrides
colorGradient
Sets the vertex colors for each of the 4 vertices of the character quads.
Declaration
public VertexGradient colorGradient { get; set; }
Property Value
colorGradientPreset
Set the vertex colors of the 4 vertices of each character quads.
Declaration
public TextColorGradient colorGradientPreset { get; set; }
Property Value
Type |
Description |
UnityEngine.TextCore.Text.TextColorGradient |
|
emojiFallbackSupport
Determines if text assets defined in the Emoji Fallback Text Assets list in the TMP Settings will be search first for characters defined as Emojis in the Unicode 14.0 standards.
Declaration
public bool emojiFallbackSupport { get; set; }
Property Value
enableAutoSizing
Declaration
public bool enableAutoSizing { get; set; }
Property Value
enableCulling
Sets the culling on the shaders. Note changing this value will result in an instance of the material.
Declaration
public bool enableCulling { get; set; }
Property Value
enableKerning
Determines if kerning is enabled or disabled.
Declaration
[Obsolete("The \"enableKerning\" property has been deprecated. Use the \"fontFeatures\" property to control what features are enabled on the text component.")]
public bool enableKerning { get; set; }
Property Value
enableVertexGradient
Determines if Vertex Color Gradient should be used
Declaration
public bool enableVertexGradient { get; set; }
Property Value
Type |
Description |
Boolean |
true if enable vertex gradient; otherwise, false .
|
enableWordWrapping
Controls whether or not word wrapping is applied. When disabled, the text will be displayed on a single line.
Declaration
[Obsolete("The enabledWordWrapping property is now obsolete. Please use the textWrappingMode property instead.")]
public bool enableWordWrapping { get; set; }
Property Value
Adds extra padding around each character. This may be necessary when the displayed text is very small to prevent clipping.
Declaration
public bool extraPadding { get; set; }
Property Value
faceColor
Sets the color of the _FaceColor property of the assigned material. Changing face color will result in an instance of the material.
Declaration
public Color32 faceColor { get; set; }
Property Value
firstOverflowCharacterIndex
The first character which exceeds the vertical bounds of its text container.
Declaration
public int firstOverflowCharacterIndex { get; }
Property Value
firstVisibleCharacter
The first character which should be made visible in conjunction with the Text Overflow Linked mode.
Declaration
public int firstVisibleCharacter { get; set; }
Property Value
flexibleHeight
Declaration
public float flexibleHeight { get; }
Property Value
flexibleWidth
Declaration
public float flexibleWidth { get; }
Property Value
font
The Font Asset to be assigned to this text object.
Declaration
public FontAsset font { get; set; }
Property Value
Type |
Description |
UnityEngine.TextCore.Text.FontAsset |
|
fontFeatures
List of OpenType font features that are enabled.
Declaration
public List<OTL_FeatureTag> fontFeatures { get; set; }
Property Value
fontMaterial
The material to be assigned to this text object. An instance of the material will be assigned to the object's renderer.
Declaration
public Material fontMaterial { get; set; }
Property Value
fontMaterials
The materials to be assigned to this text object. An instance of the materials will be assigned.
Declaration
public virtual Material[] fontMaterials { get; set; }
Property Value
fontSharedMaterial
The material to be assigned to this text object.
Declaration
public virtual Material fontSharedMaterial { get; set; }
Property Value
fontSharedMaterials
An array containing the materials used by the text object.
Declaration
public virtual Material[] fontSharedMaterials { get; set; }
Property Value
fontSize
The point size of the font.
Declaration
public float fontSize { get; set; }
Property Value
fontSizeMax
Maximum point size of the font when text auto-sizing is enabled.
Declaration
public float fontSizeMax { get; set; }
Property Value
fontSizeMin
Minimum point size of the font when text auto-sizing is enabled.
Declaration
public float fontSizeMin { get; set; }
Property Value
fontStyle
Declaration
public FontStyles fontStyle { get; set; }
Property Value
fontWeight
Control the weight of the font if an alternative font asset is assigned for the given weight in the font asset editor.
Declaration
public FontWeight fontWeight { get; set; }
Property Value
geometrySortingOrder
Determines the sorting order of the geometry of the text object.
Declaration
public VertexSortingOrder geometrySortingOrder { get; set; }
Property Value
havePropertiesChanged
Property tracking if any of the text properties have changed. Flag is set before the text is regenerated.
Declaration
public bool havePropertiesChanged { get; set; }
Property Value
horizontalAlignment
Horizontal alignment options
Declaration
public HorizontalAlignmentOptions horizontalAlignment { get; set; }
Property Value
horizontalMapping
Controls how the face and outline textures will be applied to the text object.
Declaration
public TextureMappingOptions horizontalMapping { get; set; }
Property Value
ignoreVisibility
Forces objects that are not visible to get refreshed.
Declaration
public bool ignoreVisibility { get; set; }
Property Value
isOrthographic
Declaration
public bool isOrthographic { get; set; }
Property Value
isOverlay
Sets the RenderQueue along with Ztest to force the text to be drawn last and on top of scene elements.
Declaration
public bool isOverlay { get; set; }
Property Value
isRightToLeftText
Declaration
public bool isRightToLeftText { get; set; }
Property Value
isTextObjectScaleStatic
Determines if a text object will be excluded from the InternalUpdate callback used to handle updates of SDF Scale when the scale of the text object or parent(s) changes.
Declaration
public bool isTextObjectScaleStatic { get; set; }
Property Value
isTextOverflowing
Indicates if the text exceeds the vertical bounds of its text container.
Declaration
public bool isTextOverflowing { get; }
Property Value
isTextTruncated
Property indicating whether the text is Truncated or using Ellipsis.
Declaration
public bool isTextTruncated { get; }
Property Value
isUsingBold
Property used in conjunction with padding calculation for the geometry.
Declaration
public bool isUsingBold { get; }
Property Value
isUsingLegacyAnimationComponent
Property to handle legacy animation component.
Declaration
public bool isUsingLegacyAnimationComponent { get; set; }
Property Value
isVolumetricText
Determines if the geometry of the characters will be quads or volumetric (cubes).
Declaration
public bool isVolumetricText { get; set; }
Property Value
layoutElement
Declaration
protected LayoutElement layoutElement { get; }
Property Value
layoutPriority
Declaration
public int layoutPriority { get; }
Property Value
lineSpacing
The amount of additional spacing to add between each lines of text.
Declaration
public float lineSpacing { get; set; }
Property Value
lineSpacingAdjustment
The amount of potential line spacing adjustment before text auto sizing kicks in.
Declaration
public float lineSpacingAdjustment { get; set; }
Property Value
linkedTextComponent
The linked text component used for flowing the text from one text component to another.
Declaration
public TMP_Text linkedTextComponent { get; set; }
Property Value
mappingUvLineOffset
Controls the horizontal offset of the UV of the texture mapping mode for each line of the text object.
Declaration
public float mappingUvLineOffset { get; set; }
Property Value
margin
The margins of the text object.
Declaration
public virtual Vector4 margin { get; set; }
Property Value
maxHeight
Declaration
public float maxHeight { get; }
Property Value
maxVisibleCharacters
Allows to control how many characters are visible from the input.
Declaration
public int maxVisibleCharacters { get; set; }
Property Value
maxVisibleLines
Allows control over how many lines of text are displayed.
Declaration
public int maxVisibleLines { get; set; }
Property Value
maxVisibleWords
Allows to control how many words are visible from the input.
Declaration
public int maxVisibleWords { get; set; }
Property Value
maxWidth
Declaration
public float maxWidth { get; }
Property Value
mesh
The mesh used by the font asset and material assigned to the text object.
Declaration
public virtual Mesh mesh { get; }
Property Value
minHeight
Declaration
public float minHeight { get; }
Property Value
minWidth
Declaration
public float minWidth { get; }
Property Value
outlineColor
Sets the color of the _OutlineColor property of the assigned material. Changing outline color will result in an instance of the material.
Declaration
public Color32 outlineColor { get; set; }
Property Value
outlineWidth
Sets the thickness of the outline of the font. Setting this value will result in an instance of the material.
Declaration
public float outlineWidth { get; set; }
Property Value
overflowMode
Controls the Text Overflow Mode
Declaration
public TextOverflowModes overflowMode { get; set; }
Property Value
overrideColorTags
This overrides the color tags forcing the vertex colors to be the default font color.
Declaration
public bool overrideColorTags { get; set; }
Property Value
pageToDisplay
Controls which page of text is shown
Declaration
public int pageToDisplay { get; set; }
Property Value
paragraphSpacing
The amount of additional spacing to add between each lines of text.
Declaration
public float paragraphSpacing { get; set; }
Property Value
parseCtrlCharacters
Enables or Disables parsing of CTRL characters in input text.
Declaration
public bool parseCtrlCharacters { get; set; }
Property Value
pixelsPerUnit
Declaration
public float pixelsPerUnit { get; }
Property Value
preferredHeight
Computed preferred height of the text object.
Declaration
public virtual float preferredHeight { get; }
Property Value
preferredWidth
Computed preferred width of the text object.
Declaration
public virtual float preferredWidth { get; }
Property Value
rectTransform
Returns are reference to the RectTransform
Declaration
public RectTransform rectTransform { get; }
Property Value
renderedHeight
Compute the rendered height of the text object.
Declaration
public virtual float renderedHeight { get; }
Property Value
renderedWidth
Compute the rendered width of the text object.
Declaration
public virtual float renderedWidth { get; }
Property Value
renderMode
Determines if the Mesh will be rendered.
Declaration
public TextRenderFlags renderMode { get; set; }
Property Value
richText
Enables or Disables Rich Text Tags
Declaration
public bool richText { get; set; }
Property Value
spriteAnimator
Component used to control and animate sprites in the text object.
Declaration
protected TMP_SpriteAnimator spriteAnimator { get; }
Property Value
spriteAsset
Sprite Asset used by the text object.
Declaration
public SpriteAsset spriteAsset { get; set; }
Property Value
Type |
Description |
UnityEngine.TextCore.Text.SpriteAsset |
|
styleSheet
Style sheet used by the text object.
Declaration
public TextStyleSheet styleSheet { get; set; }
Property Value
Type |
Description |
UnityEngine.TextCore.Text.TextStyleSheet |
|
text
A string containing the text to be displayed.
Declaration
public virtual string text { get; set; }
Property Value
textBounds
Returns the bounds of the text of the text object.
Declaration
public Bounds textBounds { get; }
Property Value
textInfo
Returns data about the text object which includes information about each character, word, line, link, etc.
Declaration
public TMP_TextInfo textInfo { get; }
Property Value
textPreprocessor
The ITextPreprocessor component referenced by the text object (if any)
Declaration
public ITextPreprocessor textPreprocessor { get; set; }
Property Value
textStyle
Declaration
public TextStyle textStyle { get; set; }
Property Value
Type |
Description |
UnityEngine.TextCore.Text.TextStyle |
|
textWrappingMode
Controls the text wrapping mode.
Declaration
public TextWrappingModes textWrappingMode { get; set; }
Property Value
tintAllSprites
Determines whether or not the sprite color is multiplies by the vertex color of the text.
Declaration
public bool tintAllSprites { get; set; }
Property Value
transform
Returns are reference to the Transform
Declaration
public Transform transform { get; }
Property Value
useMaxVisibleDescender
Determines if the text's vertical alignment will be adjusted based on visible descender of the text.
Declaration
public bool useMaxVisibleDescender { get; set; }
Property Value
vertexBufferAutoSizeReduction
Determines if the data structures allocated to contain the geometry of the text object will be reduced in size if the number of characters required to display the text is reduced by more than 256 characters.
This reduction has the benefit of reducing the amount of vertex data being submitted to the graphic device but results in GC when it occurs.
Declaration
public bool vertexBufferAutoSizeReduction { get; set; }
Property Value
verticalAlignment
Vertical alignment options
Declaration
public VerticalAlignmentOptions verticalAlignment { get; set; }
Property Value
verticalMapping
Controls how the face and outline textures will be applied to the text object.
Declaration
public TextureMappingOptions verticalMapping { get; set; }
Property Value
wordSpacing
The amount of additional spacing between words.
Declaration
public float wordSpacing { get; set; }
Property Value
wordWrappingRatios
Controls the blending between using character and word spacing to fill-in the space for justified text.
Declaration
public float wordWrappingRatios { get; set; }
Property Value
Methods
AdjustLineOffset(Int32, Int32, Single)
Method to adjust line spacing as a result of using different fonts or font point size.
Declaration
protected void AdjustLineOffset(int startIndex, int endIndex, float offset)
Parameters
CalculatePreferredValues(ref Single, Vector2, Boolean, TextWrappingModes)
Method to calculate the preferred width and height of the text object.
Declaration
protected virtual Vector2 CalculatePreferredValues(ref float fontSize, Vector2 marginSize, bool isTextAutoSizingEnabled, TextWrappingModes textWrapMode)
Parameters
Returns
ClearMesh()
Function to clear the geometry of the Primary and Sub Text objects.
Declaration
public virtual void ClearMesh()
ClearMesh(Boolean)
Function to clear the geometry of the Primary and Sub Text objects.
Declaration
public virtual void ClearMesh(bool uploadGeometry)
Parameters
Type |
Name |
Description |
Boolean |
uploadGeometry |
|
ComputeMarginSize()
Function to force an update of the margin size.
Declaration
public virtual void ComputeMarginSize()
ConvertToFloat(Char[], Int32, Int32)
Extracts a float value from char[] assuming we know the position of the start, end and decimal point.
Declaration
protected float ConvertToFloat(char[] chars, int startIndex, int length)
Parameters
Returns
ConvertToFloat(Char[], Int32, Int32, out Int32)
Extracts a float value from char[] given a start index and length.
Declaration
protected float ConvertToFloat(char[] chars, int startIndex, int length, out int lastIndex)
Parameters
Returns
CreateMaterialInstance(Material)
Function used to create an instance of the material
Declaration
protected virtual Material CreateMaterialInstance(Material source)
Parameters
Returns
CrossFadeAlpha(Single, Single, Boolean)
Tweens the alpha of the CanvasRenderer color associated with this Graphic.
Declaration
public override void CrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale)
Parameters
Type |
Name |
Description |
Single |
alpha |
Target alpha.
|
Single |
duration |
Duration of the tween in seconds.
|
Boolean |
ignoreTimeScale |
Should ignore Time.scale?
|
Overrides
CrossFadeColor(Color, Single, Boolean, Boolean)
Tweens the CanvasRenderer color associated with this Graphic.
Declaration
public override void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha)
Parameters
Type |
Name |
Description |
Color |
targetColor |
Target color.
|
Single |
duration |
Tween duration.
|
Boolean |
ignoreTimeScale |
Should ignore Time.scale?
|
Boolean |
useAlpha |
Should also Tween the alpha channel?
|
DestroySubMeshObjects()
Destroy Sub Mesh Objects.
Declaration
protected virtual void DestroySubMeshObjects()
DoMissingGlyphCallback(Int32, Int32, FontAsset)
Declaration
protected void DoMissingGlyphCallback(int unicode, int stringIndex, FontAsset fontAsset)
Parameters
Type |
Name |
Description |
Int32 |
unicode |
|
Int32 |
stringIndex |
|
UnityEngine.TextCore.Text.FontAsset |
fontAsset |
|
DrawTextHighlight(Vector3, Vector3, ref Int32, Color32)
Declaration
protected virtual void DrawTextHighlight(Vector3 start, Vector3 end, ref int index, Color32 highlightColor)
Parameters
DrawUnderlineMesh(Vector3, Vector3, ref Int32, Single, Single, Single, Single, Color32)
Method to add the underline geometry.
Declaration
protected virtual void DrawUnderlineMesh(Vector3 start, Vector3 end, ref int index, float startScale, float endScale, float maxScale, float sdfScale, Color32 underlineColor)
Parameters
FillCharacterVertexBuffers(Int32)
Store vertex attributes into the appropriate TMP_MeshInfo.
Declaration
protected virtual void FillCharacterVertexBuffers(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
FillCharacterVertexBuffers(Int32, Boolean)
Declaration
protected virtual void FillCharacterVertexBuffers(int i, bool isVolumetric)
Parameters
FillSpriteVertexBuffers(Int32)
Fill Vertex Buffers for Sprites
Declaration
protected virtual void FillSpriteVertexBuffers(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
ForceMeshUpdate(Boolean, Boolean)
Function to force regeneration of the text object before its normal process time. This is useful when changes to the text object properties need to be applied immediately.
Declaration
public virtual void ForceMeshUpdate(bool ignoreActiveState = false, bool forceTextReparsing = false)
Parameters
Type |
Name |
Description |
Boolean |
ignoreActiveState |
Ignore Active State of text objects. Inactive objects are ignored by default.
|
Boolean |
forceTextReparsing |
Force re-parsing of the text.
|
GetCompoundBounds()
Method returning the compound bounds of the text object and child sub objects.
Declaration
protected virtual Bounds GetCompoundBounds()
Returns
GetEllipsisSpecialCharacter(FontAsset)
Declaration
protected void GetEllipsisSpecialCharacter(FontAsset fontAsset)
Parameters
Type |
Name |
Description |
UnityEngine.TextCore.Text.FontAsset |
fontAsset |
|
GetFontAssetForWeight(Int32)
Declaration
protected FontAsset GetFontAssetForWeight(int fontWeight)
Parameters
Type |
Name |
Description |
Int32 |
fontWeight |
|
Returns
Type |
Description |
UnityEngine.TextCore.Text.FontAsset |
|
GetMaterial(Material)
Function called internally when a new material is assigned via the fontMaterial property.
Declaration
protected virtual Material GetMaterial(Material mat)
Parameters
Returns
GetMaterials(Material[])
Method returning instances of the materials used by the text object.
Declaration
protected virtual Material[] GetMaterials(Material[] mats)
Parameters
Returns
GetPaddingForMaterial()
Get the padding value for the currently assigned material
Declaration
protected virtual float GetPaddingForMaterial()
Returns
GetPaddingForMaterial(Material)
Get the padding value for the given material
Declaration
protected virtual float GetPaddingForMaterial(Material mat)
Parameters
Returns
GetParsedText()
Function which returns the text after it has been parsed and rich text tags removed.
Declaration
public virtual string GetParsedText()
Returns
GetPreferredHeight()
Method to calculate the preferred height of a text object.
Declaration
protected float GetPreferredHeight()
Returns
GetPreferredValues()
Function to Calculate the Preferred Width and Height of the text object.
Declaration
public Vector2 GetPreferredValues()
Returns
GetPreferredValues(Single, Single)
Function to Calculate the Preferred Width and Height of the text object given the provided width and height.
Declaration
public Vector2 GetPreferredValues(float width, float height)
Parameters
Returns
GetPreferredValues(String)
Function to Calculate the Preferred Width and Height of the text object given a certain string.
Declaration
public Vector2 GetPreferredValues(string text)
Parameters
Type |
Name |
Description |
String |
text |
|
Returns
GetPreferredValues(String, Single, Single)
Function to Calculate the Preferred Width and Height of the text object given a certain string and size of text container.
Declaration
public Vector2 GetPreferredValues(string text, float width, float height)
Parameters
Returns
GetPreferredWidth()
Method to calculate the preferred width of a text object.
Declaration
protected float GetPreferredWidth()
Returns
GetRenderedHeight(Boolean)
Method returning the rendered height of the text object.
Declaration
protected float GetRenderedHeight(bool onlyVisibleCharacters)
Parameters
Type |
Name |
Description |
Boolean |
onlyVisibleCharacters |
|
Returns
GetRenderedValues()
Method returning the rendered width and height of the text object.
Declaration
public Vector2 GetRenderedValues()
Returns
GetRenderedValues(Boolean)
Declaration
public Vector2 GetRenderedValues(bool onlyVisibleCharacters)
Parameters
Type |
Name |
Description |
Boolean |
onlyVisibleCharacters |
Should returned value only factor in visible characters and exclude those greater than maxVisibleCharacters for instance.
|
Returns
GetRenderedWidth(Boolean)
Method returning the rendered width of the text object.
Declaration
protected float GetRenderedWidth(bool onlyVisibleCharacters)
Parameters
Type |
Name |
Description |
Boolean |
onlyVisibleCharacters |
|
Returns
GetSharedMaterials()
Method which returns an array containing the materials used by the text object.
Declaration
protected virtual Material[] GetSharedMaterials()
Returns
GetSpecialCharacters(FontAsset)
Method used to find and cache references to the Underline and Ellipsis characters.
Declaration
protected void GetSpecialCharacters(FontAsset fontAsset)
Parameters
Type |
Name |
Description |
UnityEngine.TextCore.Text.FontAsset |
fontAsset |
|
GetTextBounds()
Method which returns the bounds of the text object;
Declaration
protected Bounds GetTextBounds()
Returns
GetTextBounds(Boolean)
Method which returns the bounds of the text object;
Declaration
protected Bounds GetTextBounds(bool onlyVisibleCharacters)
Parameters
Type |
Name |
Description |
Boolean |
onlyVisibleCharacters |
|
Returns
GetTextContainerLocalCorners()
Method to return the local corners of the Text Container or RectTransform.
Declaration
protected virtual Vector3[] GetTextContainerLocalCorners()
Returns
GetTextInfo(String)
Function used to evaluate the length of a text string.
Declaration
public virtual TMP_TextInfo GetTextInfo(string text)
Parameters
Type |
Name |
Description |
String |
text |
|
Returns
GetUnderlineSpecialCharacter(FontAsset)
Declaration
protected void GetUnderlineSpecialCharacter(FontAsset fontAsset)
Parameters
Type |
Name |
Description |
UnityEngine.TextCore.Text.FontAsset |
fontAsset |
|
HexCharsToColor(Char[], Int32)
Method to convert Hex color values to Color32
Declaration
protected Color32 HexCharsToColor(char[] hexChars, int tagCount)
Parameters
Type |
Name |
Description |
Char[] |
hexChars |
|
Int32 |
tagCount |
|
Returns
HexCharsToColor(Char[], Int32, Int32)
Method to convert Hex Color values to Color32
Declaration
protected Color32 HexCharsToColor(char[] hexChars, int startIndex, int length)
Parameters
Returns
HexToInt(Char)
Method to convert Hex to Int
Declaration
protected uint HexToInt(char hex)
Parameters
Type |
Name |
Description |
Char |
hex |
|
Returns
InternalCrossFadeAlpha(Single, Single, Boolean)
Declaration
protected virtual void InternalCrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale)
Parameters
InternalCrossFadeColor(Color, Single, Boolean, Boolean)
Declaration
protected virtual void InternalCrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha)
Parameters
LoadDefaultSettings()
Internal function used to load the default settings of text objects.
Declaration
protected void LoadDefaultSettings()
LoadFontAsset()
Method which derived classes need to override to load Font Assets.
Declaration
protected virtual void LoadFontAsset()
PackUV(Single, Single)
Declaration
protected float PackUV(float x, float y)
Parameters
Returns
PackUV(Single, Single, Single)
Function to pack scale information in the UV2 Channel.
Declaration
protected Vector2 PackUV(float x, float y, float scale)
Parameters
Returns
ParseInputText()
Method to parse the input text based on its source
Declaration
protected void ParseInputText()
ReplaceTagWithCharacter(Int32[], Int32, Int32, Char)
Replace a given number of characters (tag) in the array with a new character and shift subsequent characters in the array.
Declaration
protected void ReplaceTagWithCharacter(int[] chars, int insertionIndex, int tagLength, char c)
Parameters
Type |
Name |
Description |
Int32[] |
chars |
Array which contains the text.
|
Int32 |
insertionIndex |
The index of where the new character will be inserted
|
Int32 |
tagLength |
Length of the tag being replaced.
|
Char |
c |
The replacement character.
|
ResizeLineExtents(Int32)
Function to increase the size of the Line Extents Array.
Declaration
protected void ResizeLineExtents(int size)
Parameters
Type |
Name |
Description |
Int32 |
size |
|
SaveGlyphVertexInfo(Single, Single, Color32)
Store vertex information for each character.
Declaration
protected virtual void SaveGlyphVertexInfo(float padding, float style_padding, Color32 vertexColor)
Parameters
Type |
Name |
Description |
Single |
padding |
|
Single |
style_padding |
Style_padding.
|
Color32 |
vertexColor |
Vertex color.
|
SaveSpriteVertexInfo(Color32)
Store vertex information for each sprite.
Declaration
protected virtual void SaveSpriteVertexInfo(Color32 vertexColor)
Parameters
Type |
Name |
Description |
Color32 |
vertexColor |
|
SetActiveSubMeshes(Boolean)
Method to Enable or Disable child SubMesh objects.
Declaration
protected virtual void SetActiveSubMeshes(bool state)
Parameters
Type |
Name |
Description |
Boolean |
state |
|
SetCharArray(Char[])
Set the text using a char array.
Declaration
public void SetCharArray(char[] sourceText)
Parameters
Type |
Name |
Description |
Char[] |
sourceText |
Source char array containing the Unicode characters of the text.
|
SetCharArray(Char[], Int32, Int32)
Set the text using a char array and specifying the starting character index and length.
Declaration
public void SetCharArray(char[] sourceText, int start, int length)
Parameters
Type |
Name |
Description |
Char[] |
sourceText |
Source char array containing the Unicode characters of the text.
|
Int32 |
start |
The index of the first character to read from in the array.
|
Int32 |
length |
The number of characters in the array to be read.
|
SetCulling()
Set the culling mode on the material.
Declaration
protected virtual void SetCulling()
SetFaceColor(Color32)
Function called internally to set the face color of the material. This will results in an instance of the material.
Declaration
protected virtual void SetFaceColor(Color32 color)
Parameters
Type |
Name |
Description |
Color32 |
color |
|
SetFontBaseMaterial(Material)
Function called internally when assigning a new base material.
Declaration
protected virtual void SetFontBaseMaterial(Material mat)
Parameters
SetOutlineColor(Color32)
Function called internally to set the outline color of the material. This will results in an instance of the material.
Declaration
protected virtual void SetOutlineColor(Color32 color)
Parameters
Type |
Name |
Description |
Color32 |
color |
|
SetOutlineThickness(Single)
Function called internally to set the outline thickness property of the material. This will results in an instance of the material.
Declaration
protected virtual void SetOutlineThickness(float thickness)
Parameters
Type |
Name |
Description |
Single |
thickness |
|
SetShaderDepth()
Set the Render Queue and ZTest mode on the current material
Declaration
protected virtual void SetShaderDepth()
SetSharedMaterial(Material)
Function called internally when a new shared material is assigned via the fontSharedMaterial property.
Declaration
protected virtual void SetSharedMaterial(Material mat)
Parameters
SetSharedMaterials(Material[])
Declaration
protected virtual void SetSharedMaterials(Material[] materials)
Parameters
Type |
Name |
Description |
Material[] |
materials |
|
SetText(Char[])
Set the text using a char array.
Declaration
public void SetText(char[] sourceText)
Parameters
Type |
Name |
Description |
Char[] |
sourceText |
Source char array containing the Unicode characters of the text.
|
SetText(Char[], Int32, Int32)
Set the text using a char array and specifying the starting character index and length.
Declaration
public void SetText(char[] sourceText, int start, int length)
Parameters
Type |
Name |
Description |
Char[] |
sourceText |
Source char array containing the Unicode characters of the text.
|
Int32 |
start |
Index of the first character to read from in the array.
|
Int32 |
length |
The number of characters in the array to be read.
|
SetText(String)
This function is the same as using the text property to set the text.
Declaration
public void SetText(string sourceText)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the text.
|
SetText(String, Boolean)
This function is the same as using the text property to set the text.
Declaration
[Obsolete("Use the SetText(string) function instead.")]
public void SetText(string sourceText, bool syncTextInputBox = true)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the text.
|
Boolean |
syncTextInputBox |
This optional parameter no longer provides any functionality as this function now simple sets the .text property which is reflected in the Text Input Box.
|
SetText(String, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
SetText(String, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
SetText(String, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
SetText(String, Single, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2, float arg3)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
Single |
arg3 |
Forth float value.
|
SetText(String, Single, Single, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2, float arg3, float arg4)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
Single |
arg3 |
Forth float value.
|
Single |
arg4 |
Fifth float value.
|
SetText(String, Single, Single, Single, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2, float arg3, float arg4, float arg5)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
Single |
arg3 |
Forth float value.
|
Single |
arg4 |
Fifth float value.
|
Single |
arg5 |
Sixth float value.
|
SetText(String, Single, Single, Single, Single, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2, float arg3, float arg4, float arg5, float arg6)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
Single |
arg3 |
Forth float value.
|
Single |
arg4 |
Fifth float value.
|
Single |
arg5 |
Sixth float value.
|
Single |
arg6 |
Seventh float value.
|
SetText(String, Single, Single, Single, Single, Single, Single, Single, Single)
Formatted string containing a pattern and a value representing the text to be rendered.
Ex. TMP_Text.SetText("A = {0}, B = {1:00}, C = {2:000.0}", 10.75f, 10.75f, 10.75f);
Results "A = 10.75, B = 11, C = 010.8."
Declaration
public void SetText(string sourceText, float arg0, float arg1, float arg2, float arg3, float arg4, float arg5, float arg6, float arg7)
Parameters
Type |
Name |
Description |
String |
sourceText |
String containing the pattern.
|
Single |
arg0 |
First float value.
|
Single |
arg1 |
Second float value.
|
Single |
arg2 |
Third float value.
|
Single |
arg3 |
Forth float value.
|
Single |
arg4 |
Fifth float value.
|
Single |
arg5 |
Sixth float value.
|
Single |
arg6 |
Seventh float value.
|
Single |
arg7 |
Eighth float value.
|
SetText(StringBuilder)
Set the text using a StringBuilder object as the source.
Declaration
public void SetText(StringBuilder sourceText)
Parameters
Type |
Name |
Description |
StringBuilder |
sourceText |
The StringBuilder object containing the source text.
|
SetTextSortingOrder(Int32[])
Function to sort the geometry of the text object in accordance to the provided order.
Declaration
protected void SetTextSortingOrder(int[] order)
Parameters
Type |
Name |
Description |
Int32[] |
order |
|
SetTextSortingOrder(VertexSortingOrder)
Function to control the sorting of the geometry of the text object.
Declaration
protected void SetTextSortingOrder(VertexSortingOrder order)
Parameters
SetVertexColorGradient(TextColorGradient)
Declaration
protected void SetVertexColorGradient(TextColorGradient gradient)
Parameters
Type |
Name |
Description |
UnityEngine.TextCore.Text.TextColorGradient |
gradient |
|
SetVertices(Vector3[])
Function to push a new set of vertices to the mesh.
Declaration
public virtual void SetVertices(Vector3[] vertices)
Parameters
Type |
Name |
Description |
Vector3[] |
vertices |
|
UpdateGeometry(Mesh, Int32)
Function to update the geometry of the main and sub text objects.
Declaration
public virtual void UpdateGeometry(Mesh mesh, int index)
Parameters
UpdateMeshPadding()
Function to be used to force recomputing of character padding when Shader / Material properties have been changed via script.
Declaration
public virtual void UpdateMeshPadding()
UpdateVertexData()
Function to push the updated vertex data into the mesh and renderer.
Declaration
public virtual void UpdateVertexData()
UpdateVertexData(TMP_VertexDataUpdateFlags)
Function to push the updated vertex data into the mesh and renderer.
Declaration
public virtual void UpdateVertexData(TMP_VertexDataUpdateFlags flags)
Parameters
Events
OnFontAssetRequest
Declaration
public static event Func<int, string, FontAsset> OnFontAssetRequest
Event Type
OnMissingCharacter
Event delegate to be called when the requested Unicode character is missing from the font asset.
Declaration
public static event TMP_Text.MissingCharacterEventCallback OnMissingCharacter
Event Type
OnPreRenderText
Event delegate to allow modifying the text geometry before it is uploaded to the mesh and rendered.
Declaration
public virtual event Action<TMP_TextInfo> OnPreRenderText
Event Type
OnSpriteAssetRequest
Declaration
public static event Func<int, string, SpriteAsset> OnSpriteAssetRequest
Event Type
Type |
Description |
Func<Int32, String, UnityEngine.TextCore.Text.SpriteAsset> |
|