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

Parameters

text 要编辑的文本。应将该函数的返回值指定给该字符串,如示例中所示。
maxLength 字符串的最大长度。如果省略,用户可以键入任意长度的字符串。
style 要使用的样式。如果省略,则使用当前 GUISkintextField 样式。
options An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.<br> See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

string 编辑后的字符串。

Description

创建一个可供用户编辑字符串的多行文本字段。


Text area in the Game View.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public string stringToEdit = "Hello World\nI've got 2 lines..."; void OnGUI() { stringToEdit = GUILayout.TextArea(stringToEdit, 200); } }