text mesh pro 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: 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.";
}
}