Version: 2017.3
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[] contents, 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);
public static int Toolbar (int selected, string[] texts, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options);
public static int Toolbar (int selected, Texture[] images, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options);
public static int Toolbar (int selected, GUIContent[] contents, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options);

パラメーター

selected 選択したボタンのインデックスを返します
texts グリッドボタン上に表示する文字列配列
images グリッドボタン上に表示するテクスチャ配列
contents グリッドボタンのテキスト、画像、ツールチップとなる GUIContent 配列
style 使用するスタイル。省略された場合は、現在の GUISkin にある button スタイルを使用します。
options 指定してレイアウトオプションを渡すときのレイアウトオプションのリスト。ここで設定したものは style によって設定された値を上書きします。
See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
buttonSize Determines how toolbar button size is calculated.

戻り値

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); } }