Unity: Use Unicode Characters With TextMeshPro; Add Newline Character

11/8/2019 5:07:57 PM

Set a TextMeshPro text value with Unicode characters and add a new line character.


//if you need to find the tmp object
var tmp_object = GameObject.Find("My TMP Text").GetComponent();

//set the text of the tmp object
tmp_object.text = "Hello world";       
tmp_object.text += "\n"; //new line character
tmp_object.text += "Warm today. Its 100" + "\u00b0";
tmp_object.text += "\n"; //new line character
tmp_object.text += "Warm yesterday";
tmp_object.text += "\n"; //new line character
tmp_object.text += "Even warmer today";