- 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.Box 盒子
static function Box (image : Texture, params options : GUILayoutOption[]) : void
static function Box (text : string, params options : GUILayoutOption[]) : void
static function Box (content : GUIContent, params options : GUILayoutOption[]) : void
static function Box (image : Texture, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Box (text : string, style : GUIStyle, params options : GUILayoutOption[]) : void
static function Box (content : GUIContent, style : GUIStyle, params options : GUILayoutOption[]) : void
Parameters参数
-
textText to display on the box.
显示在box上的文本 -
imageTexture to display on the box.
显示在box上的纹理 -
contentText, image and tooltip for this box.
用于该box的文本、图片和工具提示 -
styleThe style to use. If left out, the box style from the current GUISkin is used.
使用的样式。如果不使用,该box使用当前的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 box.
创建一个自动布局的box。
This will make a solid box. If you want to make a box with some contents inside, use the style paramenter of one of the subgroup functions (BeginHorizontal, BeginVertical, etc...).
这将创建一个实心盒体。如果你想创建一些内容在里面,使用分组函数的样式参数(BeginHorizontal, BeginVertical等)。
Boxes 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.Box(tex);
GUILayout.Box("This is an sized label");
}
}
// Draws a texture and a label inside 2 different boxes
//绘制一个纹理和一个标签在两个不同的盒中
var tex : Texture;
function OnGUI() {
if(!tex) {
Debug.LogError("Missing texture, assign a texture in the inspector");
}
GUILayout.Box(tex);
GUILayout.Box("This is an sized label");
}