Hey there, I have been having a little weird problem with TextMeshProUGUI now, the thing is, I have an array of serialized texts when I try to set them one by one to my textmeshprougui array, the rich text that they have will not be interpreted as rich text but displayed directly.
If I type even one letter or something to existing texts in runtime, they got corrected. I am suspecting an execution order issue but still unsure. Example code for reproducing at the down below. Please use rich text tags in the inspector for strings.
[SerializeField] private string[] myTexts;
[SerializeField] private TextMeshProUGUI[] myTextGuis;
private void Start()
{
for(var i=0;i<myTexts.Lenght;i++)
{
myTextGuis[i].text = myTexts[i];
}
}
1 Like
Can you provide an example of the text you are using? Please copy / paste the text in quotes.
Sorry for the necro but It happened to me right now, and I want to close this thread for the future me. It seems like if we set the rich text tag of Text Mesh Pro from the editor it’s ok, but when you apply a text with embedded rich text tags it seems to be interpreted as strings and not rich text.
I resolved the issue by discovering this: Newline \n not parsing correctly
If you use something like \n you need to substitute it with
or \n. In Editor \n works fine, but if you used it programmatically it won’t work. In your localization I suggest using rich tags, since with other unity packages as text animator is more uniform/conforms to use tags instead of \r \n
1 Like