お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Closeposition | ツールバーを描画するスクリーン上のRect |
selected | 選択されたボタンのインデックス |
texts | ツールバーボタン上に表示する文字列配列 |
images | ツールバーボタン上に表示するテクスチャ配列 |
contents | ツールバーボタンのテキスト、画像、ツールチップとなるGUIContent配列 |
style | 使用するスタイル。省略された場合は、現在のGUISkinにある button スタイルを使用します。 |
int 選択したボタンのインデックスを返します
ツールバー
var toolbarInt : int = 0; var toolbarStrings : String[] = ["Toolbar1", "Toolbar2", "Toolbar3"]; function OnGUI () { toolbarInt = GUI.Toolbar (Rect (25, 25, 250, 30), toolbarInt, toolbarStrings); }
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); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): public toolbarInt as int = 0 public toolbarStrings as (string) = (of string: 'Toolbar1', 'Toolbar2', 'Toolbar3') def OnGUI() as void: toolbarInt = GUI.Toolbar(Rect(25, 25, 250, 30), toolbarInt, toolbarStrings)