- Home /
Text Mesh Pro is not displaying the text as I input it
I have just started using text mesh pro and I am changing the text through script.
currentLevelText.SetText (currentTAKOWord.StageName + ": " + currentTAKOWord.Level.ToString ());
Where currentLevelText is the textmeshprogui object and stage name is mercury and level is 2 and in the inspector I get the result as this
However the actual text mesh comes out like this.
And the : 2 overlaps with mercury. I tried storing it in a temporary string and then displaying it but I got the same issue but when I used
currentLevelText.SetText ("Mercury: 1");
It appeared correctly in the game view.
Any help appreciated.
Answer by $$anonymous$$ · Jul 22, 2018 at 09:05 AM
A simple Solution is to just make the Text Field wider,
or if that doesn't helps,
Maybe you should separate both Parts of the Text. The "Mercury: " Part is written in one Text Mesh and the "2" Part is written in a separate Text Mesh. Then, change the Script to only change the "2" Part and not the "Mercury:" Part. Then, you are able to Position both Text Meshes so that the "Mercury: " Part doesn't overlap with the "2" Part
Your answer
Follow this Question
Related Questions
Change Textmesh.text from script 2 Answers
Unity crashes at writing TextMesh? 0 Answers
Adjust text file reading/detection 0 Answers
Adjusting the transform width to match wrapped text (TextMeshPro) 0 Answers