# IntField

> Make a text field for entering integers.

## Definition

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

## IntField(int, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(int value, params GUILayoutOption[] options)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```

## IntField(int, GUIStyle, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(int value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```

## IntField(string, int, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(string label, int value, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional label to display in front of the int field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```

## IntField(string, int, GUIStyle, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(string label, int value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional label to display in front of the int field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```

## IntField(GUIContent, int, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(GUIContent label, int value, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Optional label to display in front of the int field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```

## IntField(GUIContent, int, GUIStyle, GUILayoutOption\[])

Make a text field for entering integers.

```csharp
public static int IntField(GUIContent label, int value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Optional label to display in front of the int field.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                    |
| ---------------------------------------------------------- | ------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The value entered by the user. |

### Remarks

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

*Clone the Selected object a number of times.*

### Examples

```csharp
// Editor Script that clones the selected GameObject a number of times.

using UnityEditor;
using UnityEngine;

public class IntFieldExample : EditorWindow
{
    static int clones = 1;

    [MenuItem("Examples/Clone Object")]
    static void Init()
    {
        EditorWindow window = GetWindow(typeof(IntFieldExample));
        window.Show();
    }

    void OnGUI()
    {
        clones = EditorGUILayout.IntField("Number of clones:", clones);

        if (GUILayout.Button("Clone!"))
        {
            if (!Selection.activeGameObject)
            {
                Debug.Log("Select a GameObject first");
                return;
            }

            for (var i = 0; i < clones; i++)
                Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);
        }
    }
}
```
