static function Label (image : Texture, params options : GUILayoutOption[]) : void
static function Label (text : string, params options : GUILayoutOption[]) : void
static function Label (content : GUIContent, params options : GUILayoutOption[]) : void
static function Label (image : Texture, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Label (text : string, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Label (content : GUIContent, style : GUIStyle, params options : GUILayoutOption[]) : void
Description描述
Make an auto-layout label.
创建一个自动布局的标签。
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控件。
Label in the Game View.
在游戏视图中的标签。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Texture tex;
void OnGUI() {
if (!typeof(tex))
Debug.LogError("Missing texture, assign a texture in the inspector");
GUILayout.Label(tex);
GUILayout.Label("This is an sized label");
}
}
// Draws a texture and a label after the Texture using GUILayout.
//使用GUILayout绘制一个纹理和一个标签
var tex : Texture;
function OnGUI() {
if(!tex) {
Debug.LogError("Missing texture, assign a texture in the inspector");
}
GUILayout.Label(tex);
GUILayout.Label("This is an sized label");
}