I’m trying to make one word the color red, while the rest is white. I’m using TextMeshPro. I looked up their docs, but they don’t show you how to code it through scripting. How can I do it?
gameOverCoinText.text = "you collected " + "<color="red"> + "coins";
For example you have GameObject tmpObj1 with TextMeshPro. So you can set any colors by 2 ways, see examples below:
TextMeshProUGUI TMP1 = tmpObj1.GetComponent<TextMeshProUGUI>(); TMP1.color = Color.White; //1st example TMP1.text = "111<#3E8FB7>222</color>333<#0094FF>444</color>555"; //2nd example
In documentation “TextMesh Pro User Guide 2016.pdf” look at “Text Input Box” section for tags.