-
Notifications
You must be signed in to change notification settings - Fork 0
Sliders.md
cfloutier edited this page Apr 27, 2024
·
8 revisions
Sliders are modified to have a better look than unity standard.
It adds
- Options to define the label position
- Options to write the value in the label
- Min - Max limits drawn on bottom
- a green line (just for the look)

use the K2Slider or K2SliderInt, they share the same style and attributes. but the behavior is slightly different

- Label : if none the Label is hidden
- Label On Top : if true label is located on top of slider, if false on the left
-
Print Value : print values in the label
-
Min Max Label : adds a line on the bottom to show min and max values.
- use the
xvalue, the real Min Max value will be printed there :
- use a formated string like
cold-hot(separated with a -)
- use the
- Value : the startvalue
- Min : The minimum value
- Max : the maximum value
like standard Unity Editor fields it can be finely adjusted by draging the label.

It can be bound with a Setting<float> or ClampSetting<float> for K2Slider
and with Setting and ClampSettingInt for the K2SliderInt.
If you bind a ClampSetting, min and max properties are copied from the settings to the UI.
ex :
public ClampSetting<int> int_item = new ClampSetting<int>("my_settings.int_item", -5, -10, 10);
public void init(VisualElement panel)
{
panel.Q<K2SliderInt>("int_settings").Bind(int_item);
}