static var changed : bool
Description描述
Returns true if any controls changed the value of the input data.
返回true,如果任何控件改变了输入数据的值。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string stringToEdit = "Modify me.";
void OnGUI() {
stringToEdit = GUI.TextField(new Rect(10, 10, 200, 20), stringToEdit, 25);
if (GUI.changed)
Debug.Log("Text field has changed.");
}
}
var stringToEdit : String = "修改我试试";
function OnGUI () {
//绘制一个文本字段,当被修改的时候打印消息
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
if (GUI.changed)
//当你修改的时候,文本的时候出现这个信息。
Debug.Log("文本字段被修改");
}