UnityEditor.EditorGUILayout.Slider C# (CSharp) Method

Slider() public static method

Make a slider the user can drag to change a value between a min and a max.

public static Slider ( GUIContent label, float value, float leftValue, float rightValue ) : float
label UnityEngine.GUIContent Optional label in front of the slider.
value float The value the slider shows. This determines the position of the draggable thumb.
leftValue float The value at the left end of the slider.
rightValue float The value at the right end of the slider.
return float
        public static float Slider(GUIContent label, float value, float leftValue, float rightValue, params GUILayoutOption[] options)
        {
            Rect position = s_LastRect = GetSliderRect(true, options);
            return EditorGUI.Slider(position, label, value, leftValue, rightValue);
        }

Same methods

EditorGUILayout::Slider ( float value, float leftValue, float rightValue ) : float
EditorGUILayout::Slider ( string label, float value, float leftValue, float rightValue ) : float
EditorGUILayout::Slider ( UnityEditor.SerializedProperty property, float leftValue, float rightValue ) : void
EditorGUILayout::Slider ( UnityEditor.SerializedProperty property, float leftValue, float rightValue, GUIContent label ) : void
EditorGUILayout::Slider ( UnityEditor.SerializedProperty property, float leftValue, float rightValue, string label ) : void

Usage Example

    void OnGUI()
    {
        EGL.LabelField("Generated texture", EditorStyles.boldLabel);

        EGL.LabelField("Show channels:");
        EGL.BeginHorizontal();
        _c[3] = GUILayout.Toggle(_c[3], "A");
        EG.BeginDisabledGroup(_c[3]);
        _c[0] = GUILayout.Toggle(_c[0], "R");
        _c[1] = GUILayout.Toggle(_c[1], "G");
        _c[2] = GUILayout.Toggle(_c[2], "B");
        EG.EndDisabledGroup();
        EGL.EndHorizontal();

        EGL.LabelField("Zoom");
        zoom = EGL.Slider(zoom, 0.2f, 3f);

        EGL.LabelField("Slice");
        slice = EGL.Slider(slice, 0f, 1f);

        Rect r_tex = EGL.BeginVertical(GUILayout.ExpandHeight(true));

        r_tex.height = r_tex.width = Mathf.Min(r_tex.height, r_tex.width);
        if (texture)
        {
            previewMaterial.SetFloat("_Zoom", zoom);
            previewMaterial.SetFloat("_Slice", slice);
            previewMaterial.SetVector("_Channels", ChannelVector());
            EG.DrawPreviewTexture(r_tex, texture, previewMaterial);
        }
        EGL.EndVertical();
    }
All Usage Examples Of UnityEditor.EditorGUILayout::Slider