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.

  • Value Max 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).

  • ScrollMode CenteredSlider.ScrollModes

    Change the value on the mouse scroll.

    • Ignore

      Do not change the value on the mouse scroll.

    • UpIncrease

      Increase the value on the mouse wheel up and decrease on the wheel down.

    • UpDecrease

      Decrease the value on the mouse wheel up and increase on the wheel down.

Events

  • OnValueChanged 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;