ドキュメント

Unity Engine

Unity Engine

FloatField

Makes a text field for entering floats.
読み終わるまでの所要時間 2 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

FloatField(Rect, float, GUIStyle)

Makes a text field for entering floats.
public static float FloatField(Rect position, float value, GUIStyle style)

Parameters

position

Rectangle on the screen to use for the float field.

value

The value to edit.

Optional GUIStyle.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUIFloatField (FloatField)
Float Field in an Editor Window.

Examples

using UnityEngine;using UnityEditor;public class EditorGUIFloatField : EditorWindow{ float sizeMultiplier = 1; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = GetWindow<EditorGUIFloatField>(); window.position = new Rect(0, 0, 210, 30); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20), "Increase scale by:", sizeMultiplier); if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!")) { Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(Rect, string, float, GUIStyle)

Makes a text field for entering floats.
public static float FloatField(Rect position, string label, float value, GUIStyle style)

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.

Optional GUIStyle.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUIFloatField (FloatField)
Float Field in an Editor Window.

Examples

using UnityEngine;using UnityEditor;public class EditorGUIFloatField : EditorWindow{ float sizeMultiplier = 1; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = GetWindow<EditorGUIFloatField>(); window.position = new Rect(0, 0, 210, 30); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20), "Increase scale by:", sizeMultiplier); if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!")) { Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(Rect, GUIContent, float, GUIStyle)

Makes a text field for entering floats.
public static float FloatField(Rect position, GUIContent label, float value, GUIStyle style)

Parameters

position

Rectangle on the screen to use for the float field.

Optional label to display in front of the float field.

value

The value to edit.

Optional GUIStyle.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUIFloatField (FloatField)
Float Field in an Editor Window.

Examples

using UnityEngine;using UnityEditor;public class EditorGUIFloatField : EditorWindow{ float sizeMultiplier = 1; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = GetWindow<EditorGUIFloatField>(); window.position = new Rect(0, 0, 210, 30); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20), "Increase scale by:", sizeMultiplier); if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!")) { Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}