Toolbar
Make a toolbar.
Read time 4 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.IMGUIModule
Toolbar(Rect, int, string[])
Make a toolbar.
public static int Toolbar(Rect position, int selected, string[] texts)
Parameters
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, Texture[])
Make a toolbar.
public static int Toolbar(Rect position, int selected, Texture[] images)
Parameters
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, GUIContent[])
Make a toolbar.
public static int Toolbar(Rect position, int selected, GUIContent[] contents)
Parameters
Rectangle on the screen to use for the toolbar.
The index of the selected button.
An array of text, image and tooltips for the toolbar buttons.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, string[], GUIStyle)
Make a toolbar.
public static int Toolbar(Rect position, int selected, string[] texts, GUIStyle style)
Parameters
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, Texture[], GUIStyle)
Make a toolbar.
public static int Toolbar(Rect position, int selected, Texture[] images, GUIStyle style)
Parameters
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, GUIContent[], GUIStyle)
Make a toolbar.
public static int Toolbar(Rect position, int selected, GUIContent[] contents, GUIStyle style)
Parameters
Rectangle on the screen to use for the toolbar.
The index of the selected button.
An array of text, image and tooltips for the toolbar buttons.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}
Toolbar(Rect, int, GUIContent[], GUIStyle, ToolbarButtonSize)
Make a toolbar.
public static int Toolbar(Rect position, int selected, GUIContent[] contents, GUIStyle style, GUI.ToolbarButtonSize buttonSize)
Parameters
Rectangle on the screen to use for the toolbar.
The index of the selected button.
An array of text, image and tooltips for the toolbar buttons.
Determines how toolbar button size is calculated.
Returns
Type | Description |
|---|---|
| int | The index of the selected button. |
Examples
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); }}