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参数

  • position
    Rectangle on the screen to use for the float field.
    屏幕上用于浮点的矩形区域    
  • label
    Optional label to display in front of the float field.
    显示在浮点前面的可选择标签    
  • value
    The value to edit. // 用来编辑的值
  • style
    Optional GUIStyle. // 可选GUIStyle样式

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;}}


,