GUILayout
- BeginArea
- BeginHorizontal
- BeginScrollView
- BeginVertical
- Box
- Button
- EndArea
- EndHorizontal
- EndScrollView
- EndVertical
- ExpandHeight
- ExpandWidth
- FlexibleSpace
- Height
- HorizontalScrollbar
- HorizontalSlider
- Label
- MaxHeight
- MaxWidth
- MinHeight
- MinWidth
- PasswordField
- RepeatButton
- SelectionGrid
- Space
- TextArea
- TextField
- Toggle
- Toolbar
- VerticalScrollbar
- VerticalSlider
- Width
- Window
GUILayout.TextArea 文本区域
static function TextArea (text : string, params options : GUILayoutOption[]) : string
static function TextArea (text : string, maxLength : int, params options : GUILayoutOption[]) : string
static function TextArea (text : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TextArea (text : string, maxLength : int, style : GUIStyle, params options : GUILayoutOption[]) : string
Parameters参数
-
textText to edit. The return value of this function should be assigned back to the string as shown in the example.
可编辑文本,这个函数的返回值应该赋回给这个字符串 -
maxLengthThe maximum length of the string. If left out, the user can type for ever and ever.
字符串的最大长度,如果不设置,用户将可以永远输入下去。 -
styleThe style to use. If left out, the textArea style from the current GUISkin is used.
使用的样式。如果不使用,该文本区域使用当前的GUISkin皮肤 -
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style.
布局选项指定额外布局属性的一个可选列表。这里传递任意值都将覆盖由style定义的设置。
参考: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
string - the edited string.
返回字符串类型,可编辑的字符串。
Description描述
Make a multi-line text field where the user can edit a string.
创建一个多行密码文本区域,用户可以编辑其中字符串。
Text area in the Game View.
在游戏视图中的文本区域。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string stringToEdit = "Hello World\nI've got 2 lines...";
void OnGUI() {
stringToEdit = GUILayout.TextArea(stringToEdit, 200);
}
}
var stringToEdit : String = "Hello World\nI've got 2 lines...";
function OnGUI () {
// Make a multiline text area that modifies stringToEdit.
//创建一个多行文本区域,修改其中的字符串
stringToEdit = GUILayout.TextArea (stringToEdit, 200);
}
最后修改:2011年6月14日 Tuesday 14:44