Answers for "how to refer textmeshpro text"

C#
2

textmeshpro text

using TMPro;

public TextMeshProUGUI text;
text.text = "Text updated. <sub>Subscript</sub> <sup>Superscript</sup> <b>Bold</b> <u>Underlined</u>";
Posted by: Guest on September-22-2021
1

reference to textmeshpro

9. Why can't I get the text component via GetComponent<TextMeshPro>()?
You can, but there are actually two different types of TextMeshPro 
components. Non-UI text components have the TextMeshPro type, as expected
which can be access using GetComponent<TextMeshPro>(). The UI text components 
have the TextMeshProUGUI type. You can get those via 
GetComponent<TextMeshProUGUI>(). 

Both TextMesh Pro components inherit from a base class which is 
TMP_Text where you can also get a reference to either types of TextMesh Pro 
components by using GetComponent<TMP_Text>(). To access these components in 
your scripts you will also need to include the "using TMPro;" namespace.

From https://forum.unity.com/threads/how-to-create-object-reference-to-text-mesh-pro-object.505796/
Posted by: Guest on November-04-2021

C# Answers by Framework

Browse Popular Code Answers by Language