ドキュメント

Unity Engine

Unity Engine

TextArea

Make a multi-line text field where the user can edit a string.
読み終わるまでの所要時間 4 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.IMGUIModule

TextArea(string, GUILayoutOption[])

Make a multi-line text field where the user can edit a string.
public static string TextArea(string text, params GUILayoutOption[] options)

Parameters

text

Text to edit. The return value of this function should be assigned back to the string as shown in the example.

An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the
style
.<br> Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

stringThe edited string.

Remarks

GUILayoutTextArea (TextArea)
Text area in the Game View.

Examples

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.
public static string TextArea(string text, int maxLength, params GUILayoutOption[] options)

Parameters

text

Text to edit. The return value of this function should be assigned back to the string as shown in the example.

maxLength

The maximum length of the string. If left out, the user can type for ever and ever.

An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the
style
.<br> Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

stringThe edited string.

Remarks

GUILayoutTextArea (TextArea)
Text area in the Game View.

Examples

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.
public static string TextArea(string text, GUIStyle style, params GUILayoutOption[] options)

Parameters

text

Text to edit. The return value of this function should be assigned back to the string as shown in the example.

The style to use. If left out, the
textField
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
.<br> Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

stringThe edited string.

Remarks

GUILayoutTextArea (TextArea)
Text area in the Game View.

Examples

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.
public static string TextArea(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options)

Parameters

text

Text to edit. The return value of this function should be assigned back to the string as shown in the example.

maxLength

The maximum length of the string. If left out, the user can type for ever and ever.

The style to use. If left out, the
textField
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
.<br> Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

stringThe edited string.

Remarks

GUILayoutTextArea (TextArea)
Text area in the Game View.

Examples

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); }}