The Text Mesh component generates 3D geometry that displays text strings.
Note: This is a legacy component that has limited functionality. For information on more recent, full-featured ways of displaying text, see Creating user interfaces (UI).
You can create a new Text Mesh from Component > Mesh > Text Mesh.
属性: | 功能: |
---|---|
Text | 要渲染的文本 |
Offset Z | 文本在绘制时应从 transform.position.z 偏移多远 |
Character Size | 每个字符的大小(此设置会缩放整个文本。) |
Line Spacing | 文本的行间距。 |
Anchor | 文本的哪个点共享变换位置。 |
Alignment | 如何对齐文本行(选项包括 Left、Right、Center)。 |
Tab Size | 为制表符“\t”字符插入的空格数。这是“空格键”字符偏移的倍数。 |
Font Size | 字体的大小。此设置可覆盖动态字体的大小。 |
Font Style | 字体的渲染样式。字体需要标记为动态。 |
Rich Text | 选择此项后将在渲染文本时启用标签处理。 |
Font | 渲染文本时使用的 TrueType 字体。 |
Color | 渲染文本时使用的全局颜色。 |
Text Meshes can be used for rendering road signs, graffiti etc. The Text Mesh places text in the 3D scene. To make generic 2D text for GUIs, use a GUI Text component instead.
请按照以下步骤使用自定义字体创建文本网格:
注意:如果要更改文本网格的字体,需要设置该组件的字体属性,并将字体材质的纹理设置为正确的字体纹理。为此,可使用字体资源的折叠三角形来定位此纹理。如果忘记设置纹理,网格中的文本将显示为块状且未对齐。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.