- Home /
Multiple Rich Text Not Working
I am currently working on a inventory system for my game. I have a text to show all the stats of the item that I'm hovering over with my mouse. I want to change the color, bold, size between the title and the description. Since everything is on the same string, I'm using the Rich Text. https://docs.unity3d.com/Manual/StyledText.html
Everything fine if I only use on between the title and the description.
data = "<b>" + item.Title + "</b>" + item.Description;
But When I use two of them it doesn't work.
data = "<b><size=16>" + item.Title + "</b></size>" + item.Description;
When I use two the text says: <b>Ammo</b>Description
I have Rich Text turned on in the inspector
Answer by Bunny83 · Aug 18, 2017 at 06:07 PM
You have not correctly nested your tags. You need to close the tags in reverse order.
"<b><size=16>" + item.Title + "</size></b>" + item.Description;
Just like in HTML
To make this clear: You first open a "B" tag and inside that "B" tag you open a "size" tag. Before you can close your outer "B" tag you have to close the size tag first.
Your answer
Follow this Question
Related Questions
change button and text color together 1 Answer
Text Changes to Black 7 Answers
How do I invert the color of ui text to make it more readable, on a messy background? 4 Answers
How To Change Color Of Text On UI When It's Selected | Unity 4.6 3 Answers
FPS problem with Multi-Colored text on Unity 5 uGUI via Rich Text 0 Answers