# IntPopup

> Makes an integer popup selection field.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## IntPopup(Rect, int, string\[], int\[], GUIStyle)

Makes an integer popup selection field.

```csharp
public static int IntPopup(Rect position, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value of the option the field shows.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): An array with the displayed options the user can choose from.**** (\[int\[]]\(https\://learn.microsoft.com/dotnet/api/system.int32)): An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

| Type                                                       | Description                                                 |
| ---------------------------------------------------------- | ----------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value of the option that has been selected by the user. |

### Remarks

Takes the currently selected integer as a parameter and returns the integer selected by the user.

![EditorGUIIntPopup (IntPopup)](/api/media?file=/engine/6000.0/media/images/EditorGUIIntPopup.png)

*Int Popup in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;


// Multiplies the scale of the selected transform.

class EditorGUIIntPopup : EditorWindow
{
    int selectedSize = 1;
    string[] names = { "Double", "Triple", "Quadruple" };
    int[] sizes = { 2, 3, 4 };

    [MenuItem("Examples/Editor GUI Int Popup usage")]
    static void Init()
    {
        EditorWindow window = GetWindow<EditorGUIIntPopup>();
        window.position = new Rect(0, 0, 180, 60);
        window.Show();
    }

    void OnGUI()
    {
        selectedSize = EditorGUI.IntPopup(
            new Rect(3, 3, position.width - 6, 20),
            "Size:",
            selectedSize,
            names,
            sizes);

        if (GUI.Button(new Rect(0, 25, position.width, position.height - 27), "Modify"))
        {
            Rescale();
        }
    }

    void Rescale()
    {
        if (Selection.activeTransform)
        {
            Selection.activeTransform.localScale *= selectedSize;
        }
        else
        {
            Debug.LogError("No Object selected, please select an object to scale.");
        }
    }
}
```

## IntPopup(Rect, int, GUIContent\[], int\[], GUIStyle)

Makes an integer popup selection field.

```csharp
public static int IntPopup(Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value of the option the field shows.**** (\[GUIContent\[]]\(/engine/6000.0/script-reference/unityengine/guicontent)): An array with the displayed options the user can choose from.**** (\[int\[]]\(https\://learn.microsoft.com/dotnet/api/system.int32)): An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

| Type                                                       | Description                                                 |
| ---------------------------------------------------------- | ----------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value of the option that has been selected by the user. |

### Remarks

Takes the currently selected integer as a parameter and returns the integer selected by the user.

![EditorGUIIntPopup (IntPopup)](/api/media?file=/engine/6000.0/media/images/EditorGUIIntPopup.png)

*Int Popup in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;


// Multiplies the scale of the selected transform.

class EditorGUIIntPopup : EditorWindow
{
    int selectedSize = 1;
    string[] names = { "Double", "Triple", "Quadruple" };
    int[] sizes = { 2, 3, 4 };

    [MenuItem("Examples/Editor GUI Int Popup usage")]
    static void Init()
    {
        EditorWindow window = GetWindow<EditorGUIIntPopup>();
        window.position = new Rect(0, 0, 180, 60);
        window.Show();
    }

    void OnGUI()
    {
        selectedSize = EditorGUI.IntPopup(
            new Rect(3, 3, position.width - 6, 20),
            "Size:",
            selectedSize,
            names,
            sizes);

        if (GUI.Button(new Rect(0, 25, position.width, position.height - 27), "Modify"))
        {
            Rescale();
        }
    }

    void Rescale()
    {
        if (Selection.activeTransform)
        {
            Selection.activeTransform.localScale *= selectedSize;
        }
        else
        {
            Debug.LogError("No Object selected, please select an object to scale.");
        }
    }
}
```

## IntPopup(Rect, GUIContent, int, GUIContent\[], int\[], GUIStyle)

Makes an integer popup selection field.

```csharp
public static int IntPopup(Rect position, GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the field.**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Optional label in front of the field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value of the option the field shows.**** (\[GUIContent\[]]\(/engine/6000.0/script-reference/unityengine/guicontent)): An array with the displayed options the user can choose from.**** (\[int\[]]\(https\://learn.microsoft.com/dotnet/api/system.int32)): An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

| Type                                                       | Description                                                 |
| ---------------------------------------------------------- | ----------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value of the option that has been selected by the user. |

### Remarks

Takes the currently selected integer as a parameter and returns the integer selected by the user.

![EditorGUIIntPopup (IntPopup)](/api/media?file=/engine/6000.0/media/images/EditorGUIIntPopup.png)

*Int Popup in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;


// Multiplies the scale of the selected transform.

class EditorGUIIntPopup : EditorWindow
{
    int selectedSize = 1;
    string[] names = { "Double", "Triple", "Quadruple" };
    int[] sizes = { 2, 3, 4 };

    [MenuItem("Examples/Editor GUI Int Popup usage")]
    static void Init()
    {
        EditorWindow window = GetWindow<EditorGUIIntPopup>();
        window.position = new Rect(0, 0, 180, 60);
        window.Show();
    }

    void OnGUI()
    {
        selectedSize = EditorGUI.IntPopup(
            new Rect(3, 3, position.width - 6, 20),
            "Size:",
            selectedSize,
            names,
            sizes);

        if (GUI.Button(new Rect(0, 25, position.width, position.height - 27), "Modify"))
        {
            Rescale();
        }
    }

    void Rescale()
    {
        if (Selection.activeTransform)
        {
            Selection.activeTransform.localScale *= selectedSize;
        }
        else
        {
            Debug.LogError("No Object selected, please select an object to scale.");
        }
    }
}
```

## IntPopup(Rect, string, int, string\[], int\[], GUIStyle)

Makes an integer popup selection field.

```csharp
public static int IntPopup(Rect position, string label, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the field.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional label in front of the field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value of the option the field shows.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): An array with the displayed options the user can choose from.**** (\[int\[]]\(https\://learn.microsoft.com/dotnet/api/system.int32)): An array with the values for each option. If optionValues a direct mapping of selectedValue to displayedOptions is assumed.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

| Type                                                       | Description                                                 |
| ---------------------------------------------------------- | ----------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value of the option that has been selected by the user. |

### Remarks

Takes the currently selected integer as a parameter and returns the integer selected by the user.

![EditorGUIIntPopup (IntPopup)](/api/media?file=/engine/6000.0/media/images/EditorGUIIntPopup.png)

*Int Popup in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;


// Multiplies the scale of the selected transform.

class EditorGUIIntPopup : EditorWindow
{
    int selectedSize = 1;
    string[] names = { "Double", "Triple", "Quadruple" };
    int[] sizes = { 2, 3, 4 };

    [MenuItem("Examples/Editor GUI Int Popup usage")]
    static void Init()
    {
        EditorWindow window = GetWindow<EditorGUIIntPopup>();
        window.position = new Rect(0, 0, 180, 60);
        window.Show();
    }

    void OnGUI()
    {
        selectedSize = EditorGUI.IntPopup(
            new Rect(3, 3, position.width - 6, 20),
            "Size:",
            selectedSize,
            names,
            sizes);

        if (GUI.Button(new Rect(0, 25, position.width, position.height - 27), "Modify"))
        {
            Rescale();
        }
    }

    void Rescale()
    {
        if (Selection.activeTransform)
        {
            Selection.activeTransform.localScale *= selectedSize;
        }
        else
        {
            Debug.LogError("No Object selected, please select an object to scale.");
        }
    }
}
```
