EditorGUI.IntField 整型字段

static function IntField (position : Rect, value : float, style : GUIStyle = EditorStyles.numberField) : int
static function IntField (position : Rect, label : string, value : float, style : GUIStyle = EditorStyles.numberField) : int
static function IntField (position : Rect, label : GUIContent, value : float, style : GUIStyle = EditorStyles.numberField) : int

Parameters参数

Returns

int - The value entered by the user.

返回整数 - 用户输入的值。

Description描述

Make a text field for entering integers.

制作一个文本字段,用于输入整数。

EditorGUI.IntField 整数字段

Int Field in an Editor Window.
在编辑器中的整数字段。

// Editor Script that clones the selected GameObject a number of times.

// 编辑器脚本,克隆选择游戏对象的次数。



class EditorGUIIntField extends EditorWindow {



	var clones : int = 1;



	@MenuItem("Examples/Clone Object")

	static function Init() {

		var window = GetWindow(EditorGUIIntField);

		window.Show();

	}



	function OnGUI() {

		sizeMultiplier = EditorGUI.IntField(Rect(0,35,position.width,15),

			"Number of clones:",

			clones);

		if(GUI.Button(Rect(0,10,position.width, 20), "Clone!"))

			for(var i = 0; i < clones; i++)

				Instantiate(Selection.activeGameObject, Vector3.zero, Quaternion.identity);

	}

}
Page last updated: 2011-6-23