Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

selected

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

images

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

contents

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

An array of strings to show on the buttons.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

images

An array of textures on the buttons.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

An array of strings to show on the buttons.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

images

An array of textures on the buttons.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

contents

An array of text, image and tooltips for the button.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

contents

An array of text, image and tooltips for the button.

The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

contents

An array of text, image and tooltips for the button.

enabled


The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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

selected

The index of the selected button.

contents

An array of text, image and tooltips for the button.

enabled


The style to use. If left out, the button style from the current GUISkin is used.

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.

Returns

Type

Description

intThe index of the selected button.

Remarks

GUILayoutToolbar (Toolbar)
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); }}