Unity 2018 Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

Styling substrings with Rich Text

Each separate UI Text component can have its own color, size, boldness styling, and so on. However, if you wish to quickly add some highlighting style to part of a string to be displayed to the user, the following are examples of some of the HTML-style markups that are available without the need to create separate UI Text objects:

  • Embolden text with the "b" markup: I am <b>bold</b>
  • Italicize text with the "i" markup: I am <i>italic</i>
  • Set the text color with hex values or a color name: I am <color=green>green text </color>, but I am <color=#FF0000>red</color>
Learn more from the Unity online manual's Rich Text page at  http://docs.unity3d.com/Manual/StyledText.html.