Toolbar
Make a toolbar.
Read time 11 minutesLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
Toolbar(int, string[], GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, string[] texts, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of strings to show on the buttons.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, Texture[], GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, Texture[] images, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of textures on the buttons.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, GUIContent[], GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, GUIContent[] contents, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of text, image and tooltips for the button.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, string[], GUIStyle, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, string[] texts, GUIStyle style, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of strings to show on the buttons.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, Texture[], GUIStyle, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, Texture[] images, GUIStyle style, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of textures on the buttons.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, string[], GUIStyle, ToolbarButtonSize, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, string[] texts, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of strings to show on the buttons.
Determines how toolbar button size is calculated.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, Texture[], GUIStyle, ToolbarButtonSize, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, Texture[] images, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of textures on the buttons.
Determines how toolbar button size is calculated.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, GUIContent[], GUIStyle, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, GUIContent[] contents, GUIStyle style, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of text, image and tooltips for the button.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, GUIContent[], GUIStyle, ToolbarButtonSize, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, GUIContent[] contents, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of text, image and tooltips for the button.
Determines how toolbar button size is calculated.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, GUIContent[], bool[], GUIStyle, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, GUIContent[] contents, bool[] enabled, GUIStyle style, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of text, image and tooltips for the button.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}
Toolbar(int, GUIContent[], bool[], GUIStyle, ToolbarButtonSize, GUILayoutOption[])
Make a toolbar.
public static int Toolbar(int selected, GUIContent[] contents, bool[] enabled, GUIStyle style, GUI.ToolbarButtonSize buttonSize, params GUILayoutOption[] options)
Parameters
The index of the selected button.
An array of text, image and tooltips for the button.
Determines how toolbar button size is calculated.
An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Remarks

Toolbar in the Game View.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ int toolbarInt = 0; string[] toolbarStrings = {"Toolbar1", "Toolbar2", "Toolbar3"}; void OnGUI() { toolbarInt = GUILayout.Toolbar(toolbarInt, toolbarStrings); }}