unity change text of textmesh code example
Example 1: unity change text
// To change text of a text UI element use th combination below
textGameObject.GetComponent<UnityEngine.UI.Text>().text = "text";
Example 2: how to modify text in textmesh pro unity
Using TMPro; public class TextMeshProDemo : MonoBehaviour { [SerializeField] private TextMeshPro textMeshPro; void Start() { textMeshPro.text = "Some text"; } }