UnityEditor.EditorGUILayout.DelayedFloatField C# (CSharp) Method

DelayedFloatField() public static method

Make a delayed text field for entering floats.

public static DelayedFloatField ( GUIContent label, float value ) : float
label UnityEngine.GUIContent Optional label to display in front of the float field.
value float The value to edit.
return float
        public static float DelayedFloatField(GUIContent label, float value, params GUILayoutOption[] options)
        {
            Rect position = s_LastRect = GetControlRect(true, 16f, EditorStyles.numberField, options);
            return EditorGUI.DelayedFloatField(position, label, value);
        }

Same methods

EditorGUILayout::DelayedFloatField ( GUIContent label, float value, GUIStyle style ) : float
EditorGUILayout::DelayedFloatField ( float value ) : float
EditorGUILayout::DelayedFloatField ( float value, GUIStyle style ) : float
EditorGUILayout::DelayedFloatField ( string label, float value ) : float
EditorGUILayout::DelayedFloatField ( string label, float value, GUIStyle style ) : float
EditorGUILayout::DelayedFloatField ( UnityEditor.SerializedProperty property ) : void
EditorGUILayout::DelayedFloatField ( UnityEditor.SerializedProperty property, GUIContent label ) : void

Usage Example

示例#1
0
    private void OnPlaneGenerationGUI()
    {
        planeGenerationData = planeGenerationData ?? new PlaneGenerationData();

        planeGenerationData.direction = (PlaneGenerationData.Direction)UG.EnumPopup("平面方向", planeGenerationData.direction);

        UG.BeginHorizontal();

        planeGenerationData.length = UG.DelayedFloatField("长", planeGenerationData.length);
        planeGenerationData.width  = UG.DelayedFloatField("宽", planeGenerationData.width);

        UG.EndHorizontal();

        UG.BeginHorizontal();

        planeGenerationData.verticesPerLength = UG.DelayedIntField("长顶点数", planeGenerationData.verticesPerLength);
        planeGenerationData.verticesPerWidth  = UG.DelayedIntField("宽顶点数", planeGenerationData.verticesPerWidth);

        UG.EndHorizontal();

        bool   legal        = true;
        string errorMessage = String.Empty;

        if (defaultMaterial == null)
        {
            legal         = false;
            errorMessage += "默认材质不能为空";
        }

        if (planeGenerationData.length <= 0)
        {
            legal         = false;
            errorMessage += "平面长必须大于0\n";
        }

        if (planeGenerationData.width <= 0)
        {
            legal         = false;
            errorMessage += "平面宽必须大于0\n";
        }

        if (planeGenerationData.verticesPerLength <= 0)
        {
            legal         = false;
            errorMessage += "平面长顶点数必须大于0\n";
        }

        if (planeGenerationData.verticesPerWidth <= 0)
        {
            legal         = false;
            errorMessage += "平面宽顶点数必须大于0\n";
        }

        if (legal)
        {
            if (GUILayout.Button("生成"))
            {
                MeshTool.InstantiatePlane(planeGenerationData, defaultMaterial);
            }
        }
        else
        {
            UG.HelpBox(errorMessage, MessageType.Error);
        }
    }