textmesh pro unity code example
Example 1: unity textmesh pro
using UnityEngine;
using TMPro;
public class UiManager : MonoBehaviour
{
[SerializeField]
private TextMeshProUGUI TMPtext;
}
Example 2: unity textmeshpro
using UnityEngine;
using TMPro;
public class quizManager : MonoBehaviour
{
public TextMeshProUGUI text;
void Start()
{
text.text = "example";
}
Example 3: unity get textmesh pro component
GetComponent<TMPro.TextMeshProUGUI>().text
Example 4: how to change textMesh Pro unity
public TextMeshPro TextMeshProObject;
TextMeshProObject = GetComponent<TextMeshPro>();
TextMeshProObject.text = "Hello";
TextMeshProUGUI TextMeshProLable = YourGameObject.GetComponent<TextMeshProUGUI>();
TextMeshProLable.text = "Your Text"