首页 > 解决方案 > 如何更改 Text Meshpro Inputfield 的颜色文本

问题描述

使用 Inputfield,我们可以通过以下方式轻松更改文本颜色:

Text text = _inputfield.transform.FindChild("Text").GetComponent<Text>();
text.color=Color.Red;

我如何使用 TMP_Inputfield(Inputfield Text Meshpro)来做到这一点

标签: unity3d

解决方案



<color>用标签 包裹你的文本。
例如:
This text is <color=red>RED</color> and this is <color=#ce490e>Orange</color>
并将其分配给text您的 textmeshpro 的变量

看这里


推荐阅读