text mesh pro unity scripting code example
Example 1: what to include if using text mesh pro
using UnityEngine
using TMPro;
public class MyClass : MonoBehaviour
{
private TMP_Text m_TextComponent;
private void Awake()
{
m_TextComponent = GetComponent<TMP_Text>();
m_TextComponent.text = "Some new line of text.";
}
}
Example 2: unity change tmp text from script
using UnityEngine.UI;
using TMPro;
void Update()
{
TextMeshPro lemonsss = GetComponent<TextMeshPro>();
}
Example 3: unity get textmesh pro component
GetComponent<TMPro.TextMeshProUGUI>().text