unity set text mesh pro text code example

Example 1: unity textmesh pro

using UnityEngine;
using TMPro;

public class UiManager : MonoBehaviour
{
    [SerializeField]
    private TextMeshProUGUI TMPtext;
}

Example 2: how to edit text mesh pro text

using UnityEngine;
using System.Collections;
using TMPro;

public class ExampleClass : MonoBehaviour
{
	public TextMeshProUGUI textDisplay;
    
    void Example()
    {
        textDisplay.text = "Example Text"      
    }
}

Example 3: unity change tmp text from script

using UnityEngine.UI;
using TMPro;

void Update()
{
    TextMeshPro lemonsss = GetComponent<TextMeshPro>();
}

Example 4: unity get textmesh pro component

GetComponent<TMPro.TextMeshProUGUI>().text