[UGUI] Rich text attributes of Text component

Use rich text tags to change text color, thickness, etc.

  1. Tag: Set font color
    Need to check: Rich Text
string text = "<color=red>红色文本</color> <color=blue>蓝色文本</color>";
textComponent.text = text;

string text = "<color=#FF0000>红色文本</color>"; // 使用十六进制颜色码表示红色
textComponent.text = text;
  1. Tag: Set font size
string text = "这是<size=30>大号</size>字体和<size=20>小号</size>字体";
textComponent.text = text;
  1. and tags: set bold and italics
string text = "这是<b>粗体</b>和<i>斜体</i>字体";
textComponent.text = text;
  1. Tag: insert link
string text = "点击<a href=\"https://www.example.com\">这里</a>查看更多信息";
textComponent.text = text;
  1. Tag: insert sprite (picture)
string text = "这是一个插入的精灵:<sprite name=\"SpriteName\">";
textComponent.text = text;

Guess you like

Origin blog.csdn.net/Xz616/article/details/135444209