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

  • label
    Optional label in front of the toggle. // 开关按钮前面的可选标签。
  • value
    The value to edit. // 编辑的值
  • style
    Optional GUIStyle. // 可选样式
  • options
    An optional list of layout options that specify extra layouting   properties. Any values passed in here will override settings defined by   the style.  See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
       指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。

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


,