Version: 2019.1
public static int Toolbar (Rect position, int selected, string[] texts);
public static int Toolbar (Rect position, int selected, Texture[] images);
public static int Toolbar (Rect position, int selected, GUIContent[] contents);
public static int Toolbar (Rect position, int selected, string[] texts, GUIStyle style);
public static int Toolbar (Rect position, int selected, Texture[] images, GUIStyle style);
public static int Toolbar (Rect position, int selected, GUIContent[] contents, GUIStyle style);
public static int Toolbar (Rect position, int selected, GUIContent[] contents, GUIStyle style, GUI.ToolbarButtonSize buttonSize);

パラメーター

positionツールバーを描画するスクリーン上の Rect
selected選択したボタンのインデックスを返します
textsツールバーボタン上に表示する文字列配列
imagesツールバーボタン上に表示するテクスチャ配列
contentsツールバーボタンのテキスト、画像、ツールチップとなる GUIContent 配列
style使用するスタイル。省略された場合は、現在の GUISkin にある button スタイルを使用します。
buttonSizeDetermines how toolbar button size is calculated.

戻り値

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

説明

ツールバー

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public int toolbarInt = 0; public string[] toolbarStrings = new string[] {"Toolbar1", "Toolbar2", "Toolbar3"};

void OnGUI() { toolbarInt = GUI.Toolbar(new Rect(25, 25, 250, 30), toolbarInt, toolbarStrings); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961