Hey all. When my player character picks up an item, I want the text display for that item to be a different colour from the rest of the string.
For example:
someLabel.text = “Something I want to appear on screen”;
How would I change the colour of the word “appear”, for example?
Thanks in advance.
You can use rich text formatting in your strings: Unity - Manual: Style text with rich text tags
2 Likes
Thanks for the reply. How do I do it within c#, though?
I need to change the text at runtime repeatedly.
Just assign a string that contains rich text and it will work.
someLabel.text = “Something I want to <colour=red>appear on screen”;
2 Likes
FYI this is the UI Toolkit subforum, not uGUI.
Ah, sorry then. I never look at where the post has been created. And this information NEVER shows in the notifications. I deleted my post.
Ah, I see. Thanks.
Edit: Never mind. Figured out the question I asked.
Thanks for the help.
1 Like