EditorGUILayout.FloatField 浮点数字段

static function FloatField (value : float, params options : GUILayoutOption[]) : float
static function FloatField (value : float, style : GUIStyle, params options : GUILayoutOption[]) : float
static function FloatField (label : string, value : float, params options : GUILayoutOption[]) : float
static function FloatField (label : string, value : float, style : GUIStyle, params options : GUILayoutOption[]) : float
static function FloatField (label : GUIContent, value : float, params options : GUILayoutOption[]) : float
static function FloatField (label : GUIContent, value : float, style : GUIStyle, params options : GUILayoutOption[]) : float

Parameters参数

Returns

float - The value entered by the user.

返回字符串,用户输入的值。

Description描述

Make a text field for entering float values.

制作文本字段用于输入浮点值。

EditorGUILayout.FloatField 浮点数字段

Multiply the scale of the selected GameObject.
选择的游戏物体倍增缩放。

// Editor Script that multiplies the scale of the current selected GameObject
//当前选择的游戏物体的倍增缩放
class EditorGUILayoutFloatField extends EditorWindow {

	var sizeMultiplier : float = 1;

	@MenuItem("Examples/Scale selected Object")
	static function Init() {
		var window = GetWindow(EditorGUILayoutFloatField);
		window.Show();
	}

	function OnGUI() {
		sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier);
		if(GUILayout.Button("Scale"))
			Selection.activeTransform.localScale =
			Selection.activeTransform.localScale * sizeMultiplier;
	}
}
Page last updated: 2011-7-12