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参数

Returns

int - The index of the selected button.

返回整数型,被选择按钮的索引。

Description描述

Make a toolbar

创建一个工具栏。

GUILayout.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);
}
Page last updated: 2011-6-14