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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961