Version: 5.4
public static int Toolbar (int selected, string[] texts, params GUILayoutOption[] options);
public static int Toolbar (int selected, Texture[] images, params GUILayoutOption[] options);
public static int Toolbar (int selected, GUIContent[] content, params GUILayoutOption[] options);
public static int Toolbar (int selected, string[] texts, GUIStyle style, params GUILayoutOption[] options);
public static int Toolbar (int selected, Texture[] images, GUIStyle style, params GUILayoutOption[] options);
public static int Toolbar (int selected, GUIContent[] contents, GUIStyle style, params GUILayoutOption[] options);

パラメーター

selected 選択したボタンのインデックスを返します
texts グリッドボタン上に表示する文字列配列
images グリッドボタン上に表示するテクスチャ配列
contents グリッドボタンのテキスト、画像、ツールチップとなる GUIContent 配列
style 使用するスタイル。省略された場合は、現在の GUISkin にある button スタイルを使用します。
options An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

戻り値

int 選択したボタンのインデックスを返します

説明

ツールバー


Toolbar in the Game View.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public int toolbarInt = 0; public string[] toolbarStrings = new string[] {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); } }