GUILayout
- 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.Toolbar 工具栏
static function Toolbar (selected : int, images : Texture[], params options : GUILayoutOption[]) : int
static function Toolbar (selected : int, content : GUIContent[], params options : GUILayoutOption[]) : int
static function Toolbar (selected : int, texts : string[], style : GUIStyle, params options : GUILayoutOption[]) : int
static function Toolbar (selected : int, images : Texture[], style : GUIStyle, params options : GUILayoutOption[]) : int
static function Toolbar (selected : int, contents : GUIContent[], style : GUIStyle, params options : GUILayoutOption[]) : int
Parameters参数
-
selectedThe index of the selected button
被选择按钮的索引 -
textsAn array of strings to show on the buttons.
显示在按钮上的字符串的数组。 -
imagesAn array of textures on the buttons.
显示在按钮上的纹理的数组 -
contentsAn array of text, image and tooltips for the button.
用于这个按钮的文本、图片和工具提示的数组。 -
styleThe style to use. If left out, the button 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
int - The index of the selected button.
返回整数型,被选择按钮的索引。
Description描述
Make a toolbar
创建一个工具栏。
Toolbar in the Game View.
在游戏视图中的工具栏。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public int toolbarInt = 0;
public string[] toolbarStrings = new string[] {"Toolbar1", "Toolbar2", "Toolbar3"};
void OnGUI() {
toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings);
}
}
var toolbarInt : int = 0;
var toolbarStrings : String[] = ["Toolbar1", "Toolbar2", "Toolbar3"];
function OnGUI () {
toolbarInt = GUILayout.Toolbar (toolbarInt, toolbarStrings);
}
最后修改:2011年6月14日 Tuesday 14:34