EditorGUI.FloatField 浮点数字段

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

Parameters参数

Returns

float - The value entered by the user.

返回浮点数- 用户输入的值。

Description描述

Make a text field for entering floats.

制作一个文本字段,可以输入浮点值。

EditorGUI.FloatField 浮点数字段

Float Field in an Editor Window.
编辑器中的浮点数字段。

// Editor Script that multiplies the scale of the current selected GameObject

//编辑器脚本 ,乘以当前选择对象的数值范围

class EditorGUIFloatField extends EditorWindow {



	var sizeMultiplier : float = 1;



	@MenuItem("Examples/Scale selected Object")

	static function Init() {

		var window = GetWindow(EditorGUIFloatField);

		window.position = Rect(0, 0, 210, 30);

		window.Show();

	}



	function OnGUI() {

		sizeMultiplier = EditorGUI.FloatField(Rect(3,3,150, 20),

			"Increase scale by:",

			sizeMultiplier);

		if(GUI.Button(Rect(160,3,45,20), "Scale!"))

			Selection.activeTransform.localScale =

				Selection.activeTransform.localScale * sizeMultiplier;

	}

}
Page last updated: 2011-6-22