お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
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.
Closeselected | 選択したグリッドボタンのインデックス |
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. |
int 選択したボタンのインデックスを返します
ツールバー
ゲームビューのツールバー
var toolbarInt : int = 0; var toolbarStrings : String[] = ["Toolbar1", "Toolbar2", "Toolbar3"]; function OnGUI () { toolbarInt = GUILayout.Toolbar (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 = GUILayout.Toolbar(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 = GUILayout.Toolbar(toolbarInt, toolbarStrings)