1.创建text控件
2:介绍属性:
Text:输入text框的内容
Character:
Font:字体,导入工程多个字体.ttf文件,可在这里选择,也可以通过代码进行选择
Text _text;
Font _font;
public void Awake()
{
_text = gameObject.GetComponent<Text>();
_text.font = Resources.Load<Font>("fontname");
}
FontStyle:字体风格,正常,斜体,粗体,斜粗体_text.fontStyle = FontStyle.Bold;
FontSize:字号_text.fontSize = 38;
LineSpacing:行间距_text.lineSpacing = (float )2.5;
RichText:富文本,可以改变文本框中某一个或几个字的大小颜色等大家<color=red>下午</color>好!
Paragraph:格式
Aligament:左中右,上中下对齐;
Horizontal Overflow:水平是否溢出
Vertical Overflow:垂直是否溢出
Best Fit:字体自适应,选中,文字不会溢出文本框,会根据字数自动在MinSize(最小字号)和MaxSize(最大字号)进行调节;
Color:颜色,改变整个文本框内文字的颜色;
unity基础UI梳理--text
最新推荐文章于 2024-09-12 23:02:29 发布