GUI.changed 判断改变

static var changed : bool

Description描述

Returns true if any controls changed the value of the input data.

返回true,如果任何控件改变了输入数据的值。

var stringToEdit : String = "修改我试试";

function OnGUI () {
	//绘制一个文本字段,当被修改的时候打印消息
	stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
	if (GUI.changed)	
		//当你修改的时候,文本的时候出现这个信息。
		Debug.Log("文本字段被修改");
}
最后修改:2011年6月15日 Wednesday 10:52

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。