- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.Label 标签
static function Label (position : Rect, text : string) : void
static function Label (position : Rect, image : Texture) : void
static function Label (position : Rect, content : GUIContent) : void
static function Label (position : Rect, text : string, style : GUIStyle) : void
static function Label (position : Rect, image : Texture, style : GUIStyle) : void
static function Label (position : Rect, content : GUIContent, style : GUIStyle) : void
Parameters参数
-
positionRectangle on the screen to use for the label.
标签使用的在屏幕上矩形的位置 -
textText to display on the label.
在标签上显示的文本 -
imageTexture to display on the label.
在标签上显示的纹理 -
contentText, image and tooltip for this label.
在标签上显示的文本,图片和信息提示 -
styleThe style to use. If left out, the label style from the current GUISkin is used.
使用样式,如果不使用那么,标签样式应用当前的GUISKin皮肤。
Description描述
Make a text or texture label on screen.
在屏幕上创建一个文本或者纹理标签。
Labels have no user interaction, do not catch mouse clicks and are always rendered in normal style. If you want to make a control that responds visually to user input, use a Box control.
标签没有用户交互,不捕捉鼠标点击,并总是被渲染为普通样式,如果你想创建响应用户输入的可视化控件,使用Box控件。
Example: Draw the classic Hello World! string:
举例:绘制一个经典的Hello World!字符串:
Text label on the Game View.
在游戏视图中的文本标签。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnGUI() {
GUI.Label(new Rect(10, 10, 100, 20), "Hello World!");
}
}
Example: Draw a texture on-screen. Labels are also used to display textures, instead of a string, simply pass in a texture:
举例:在屏幕上绘制一个纹理。标签也可以用来显示纹理,而不仅仅用来显示字符串,简单传递一个纹理:
Texture Label. 纹理标签
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Texture2D textureToDisplay;
void OnGUI() {
GUI.Label(new Rect(10, 40, textureToDisplay.width, textureToDisplay.height), textureToDisplay);
}
}