- BeginArea
- BeginHorizontal
- BeginScrollView
- BeginVertical
- Box
- Button
- EndArea
- EndHorizontal
- EndScrollView
- EndVertical
- ExpandHeight
- ExpandWidth
- FlexibleSpace
- Height
- HorizontalScrollbar
- HorizontalSlider
- Label
- MaxHeight
- MaxWidth
- MinHeight
- MinWidth
- PasswordField
- RepeatButton
- SelectionGrid
- Space
- TextArea
- TextField
- Toggle
- Toolbar
- VerticalScrollbar
- VerticalSlider
- Width
- Window
GUILayout.Label 标签
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
Parameters参数
-
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皮肤 -
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
布局选项指定额外布局属性的一个可选列表。这里传递任意值都将覆盖由style定义的设置。
参考: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
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");
}