【Unity3D Text】
3D Text通过"Text Mesh"组件、"MeshRender共同完成",通过如下方法要以创建一个3D Text。
3D Text对象包含如下组件:
最常用的需要所有人都关注的三个方法如下:
Font必须是ttf字体,导入ttf很简单,直接把ttf文件放入工程的Asset目录或子目录中即可。
参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/class-TextMesh.html
【GUI Text】
通过 Hierarchy 中的"Create" -> "GUI Text"创建。
其中关键参数有几下几个:
Material: Reference to the Material containing the characters to be drawn. If set, this property overrides the one in the Font asset.
Pixel Correct:If enabled, all Text characters will be drawn in the size of the imported font texture. If disabled, the characters will be resized based on the Transform's Scale.
注意要点:
GUI Texts are used to print text onto the screen in 2D. The Camera has to have a GUI Layer attached in order to render the text. Cameras include a GUI Layer by default, so don't remove it if you want to display a GUI Text. GUI Texts are positioned using only the X and Y axes. Rather than being positioned in World Coordinates, GUI Texts are positioned in Screen Coordinates, where (0,0) is the bottom-left and (1,1) is the top-right corner of the screen.
【GUILayer】
【GUI Texture】
GUI Texture用于显示一个texture,一个texture可以用作九宫格。另外一个texture有大小。
GUI Texture属性如上,很简单。和GUI Text一样,它俩作为仅有的2个受GUILayer组件影响的对象,是Unity抛弃的东西,UnityGUI被设计用来替代它俩。
参考:file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/Components/class-GuiTexture.html