GUI
- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.TextArea 文本区域
static function TextArea (position : Rect, text : String) : String
static function TextArea (position : Rect, text : String, maxLength : int) : String
static function TextArea (position : Rect, text : String, style : GUIStyle) : String
static function TextArea (position : Rect, text : String, maxLength : int, style : GUIStyle) : String
Parameters参数
- positionRectangle on the screen to use for the textArea.
用于文本区域在屏幕上矩形的位置。 - PasswordText 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皮肤。
string - the edited password.
返回被编辑的密码。
Description描述
Make a Multi-line text area where the user can edit a string.
创建多行文本区域,用户可以编辑字符串。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string stringToEdit = "Hello World\nI've got 2 lines...";
void OnGUI() {
stringToEdit = GUI.TextArea(new Rect(10, 10, 200, 100), stringToEdit, 200);
}
}
var stringToEdit : String = "Hello World\nI've got 2 lines...";
function OnGUI () {
//创建多行文本区域,可以修改编辑字符串
stringToEdit = GUI.TextArea(Rect (10, 10, 200, 100), stringToEdit, 200);
}
最后修改:2011年1月14日 Friday 21:43