Version: 2020.3
언어: 한국어
public static float FloatField (Rect position, float value, GUIStyle style= EditorStyles.numberField);
public static float FloatField (Rect position, string label, float value, GUIStyle style= EditorStyles.numberField);
public static float FloatField (Rect position, GUIContent label, float value, GUIStyle style= EditorStyles.numberField);

파라미터

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.

반환

float The value entered by the user.

설명

Makes a text field for entering floats.


Float Field in an Editor Window.

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; } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961