Centered Slider

The differences from a default slider:

  • zero at center

  • positive and negative parts have different scales.

Options

  • Value int

    Current value.

  • Use Value Limits bool

    Value cannot exceed the specified limits.

  • Limit Min int

    Minimal limit of the value.

  • Limit Max int

    Maximum limit of the value.

  • Value Min int

    Minimal value.

  • ValueMax int

    Maximal value.

  • Step int

    Value step.

  • Whole Number Of Steps bool

    Whole number of steps for the value.

  • Handle RangeSliderHandle

    Handle to drag.

  • UsableRangeRect RectTransform

    Usable range.

  • FillRect RectTransform

    GameObject to display fill (line from center to the current value).

Events

  • OnValuesChange UnityEvent<int>

  • OnChange UnityEvent

Set value

slider.Value = 150;

Set display limits

slider.LimitMin = -500;
slider.LimitMax = 250;

Set value limits

slider.UseValueLimits = true;
slider.ValueMin = -100;
slider.ValueMax = 200;