xxxxxxxxxx
using UnityEngine;
using System.Collections;
using TMPro;
public class ExampleClass : MonoBehaviour
{
public TextMeshProUGUI textDisplay;
void Example()
{
textDisplay.text = "Example Text"
}
}
xxxxxxxxxx
using UnityEngine;
using System.Collections;
using TMPro;
public class ExampleClass : MonoBehaviour
{
public TextMeshProUGUI textDisplay;
void Example()
{
textDisplay.text = "Example Text"
textDisplay.font = Resources.Load<TMP_FontAsset>("Font name");//Should placed in Resources folder
}
}
xxxxxxxxxx
using TMPro;
// This adds the function to the code
public TextMeshProUGUI (The name of textmp(a));
// Always cap the line with ; ^^^
// If your getting a compile on line 3(example) and it has TextMeshProUGUI first check if
// you have (using TMPro;) if not that's a compile error and Second Check if the UGUI is
// spelled correctly because if you type UGIU thats a compile error also.
(The name of textmp(a)).text = (variable(b)).ToString("C2");
// in this instance the (.text) can stay the same with text mesh pro
This Piece of code can make a text box (TMP) display the variable
// a = The Text Mesh Pro Text Box you need linked with a variable
// b = The Variable Being linked with a