# TextArea

> Make a multi-line text field where the user can edit a string.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.5/script-reference/unityengine.md)
* **Assembly:** UnityEngine.IMGUIModule

## TextArea(string, GUILayoutOption\[])

Make a multi-line text field where the user can edit a string.

```csharp
public static string TextArea(string text, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text to edit. The return value of this function should be assigned back to the string as shown in the example.**** (\[GUILayoutOption\[]]\(/engine/6000.5/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the `style`.\&lt;br\&gt; Additional Resources: [GUILayout.Width](/engine/6000.5/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.5/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.5/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.5/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.5/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.5/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.5/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.5/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                           | Description        |
| -------------------------------------------------------------- | ------------------ |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The edited string. |

### Remarks

![GUILayoutTextArea (TextArea)](/api/media?file=/engine/6000.5/media/images/GUILayoutTextArea.png)

*Text area in the Game View.*

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    string stringToEdit = "Hello World\nI've got 2 lines...";

    void OnGUI()
    {
        // Make a multiline text area that modifies stringToEdit.
        stringToEdit = GUILayout.TextArea(stringToEdit, 200);
    }
}
```

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

Make a multi-line text field where the user can edit a string.

```csharp
public static string TextArea(string text, int maxLength, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text to edit. The return value of this function should be assigned back to the string as shown in the example.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum length of the string. If left out, the user can type for ever and ever.**** (\[GUILayoutOption\[]]\(/engine/6000.5/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the `style`.\&lt;br\&gt; Additional Resources: [GUILayout.Width](/engine/6000.5/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.5/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.5/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.5/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.5/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.5/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.5/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.5/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                           | Description        |
| -------------------------------------------------------------- | ------------------ |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The edited string. |

### Remarks

![GUILayoutTextArea (TextArea)](/api/media?file=/engine/6000.5/media/images/GUILayoutTextArea.png)

*Text area in the Game View.*

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    string stringToEdit = "Hello World\nI've got 2 lines...";

    void OnGUI()
    {
        // Make a multiline text area that modifies stringToEdit.
        stringToEdit = GUILayout.TextArea(stringToEdit, 200);
    }
}
```

## TextArea(string, GUIStyle, GUILayoutOption\[])

Make a multi-line text field where the user can edit a string.

```csharp
public static string TextArea(string text, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text to edit. The return value of this function should be assigned back to the string as shown in the example.**** (\[GUIStyle]\(/engine/6000.5/script-reference/unityengine/guistyle)): The style to use. If left out, the `textField` style from the current [GUISkin](/engine/6000.5/script-reference/unityengine/guiskin.md) is used.**** (\[GUILayoutOption\[]]\(/engine/6000.5/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the `style`.\&lt;br\&gt; Additional Resources: [GUILayout.Width](/engine/6000.5/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.5/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.5/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.5/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.5/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.5/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.5/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.5/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                           | Description        |
| -------------------------------------------------------------- | ------------------ |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The edited string. |

### Remarks

![GUILayoutTextArea (TextArea)](/api/media?file=/engine/6000.5/media/images/GUILayoutTextArea.png)

*Text area in the Game View.*

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    string stringToEdit = "Hello World\nI've got 2 lines...";

    void OnGUI()
    {
        // Make a multiline text area that modifies stringToEdit.
        stringToEdit = GUILayout.TextArea(stringToEdit, 200);
    }
}
```

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

Make a multi-line text field where the user can edit a string.

```csharp
public static string TextArea(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text to edit. The return value of this function should be assigned back to the string as shown in the example.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum length of the string. If left out, the user can type for ever and ever.**** (\[GUIStyle]\(/engine/6000.5/script-reference/unityengine/guistyle)): The style to use. If left out, the `textField` style from the current [GUISkin](/engine/6000.5/script-reference/unityengine/guiskin.md) is used.**** (\[GUILayoutOption\[]]\(/engine/6000.5/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the `style`.\&lt;br\&gt; Additional Resources: [GUILayout.Width](/engine/6000.5/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.5/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.5/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.5/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.5/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.5/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.5/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.5/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                           | Description        |
| -------------------------------------------------------------- | ------------------ |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The edited string. |

### Remarks

![GUILayoutTextArea (TextArea)](/api/media?file=/engine/6000.5/media/images/GUILayoutTextArea.png)

*Text area in the Game View.*

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    string stringToEdit = "Hello World\nI've got 2 lines...";

    void OnGUI()
    {
        // Make a multiline text area that modifies stringToEdit.
        stringToEdit = GUILayout.TextArea(stringToEdit, 200);
    }
}
```
