OverviewUISlider component can be used to create simple sliders and progress bars. It inherits all of the functionality from the
UIProgressBar and adds an optional Thumb.

In its simplest form, all UISlider requires to function is a refrence to the
Foreground widget to modify. The widget's starting dimensions will be the dimensions of the slider when it's at 100% (UISlider.value == 1.0). How the widget will shrink from there onwards depends on the
Direction setting.
To create a very simple slider, just create a
sliced sprite and give it a width of 200 with the height of 40. This will be the slider's background -- what the slider will look like when it's empty.
Next, add a child sliced sprite to it. This sprite should be what your slider should look like when it's full. You can inset it within the parent to make the parent seem to "envelop" it if you want to make it look look better.
Now that this is done, add a UISlider script to the first sprite (the background), and make it reference the second (foreground) sprite in the
Foreground field. At this point you can hit Play and adjust the value of the slider, and the foreground sprite should react accordingly.
If you want the slider to be interactable, add a
Box Collider to it. If you want it to be highlightable, add a
UIButton to it and have it target either of the two sprites. Remember -- you can have more than one UIButton script on the same object, in case you wanted to color both sprites.
If you don't want to have a visible background, simply use a
UIWidget for the
Background instead.
You can specify a non-zero value in the
Steps field to make the slider move in specific increments. A Step value of 5 would mean that the slider's possible values will be 0%, 25%, 50%, 75% and 100%.
You can also add a
Thumb sprite that will follow the slider if you wish. The thumb object's position will be adjusted to always be on the edge of the slider. You can use it to attach highlighting effects or even a label that will follow the slider's bar as the slider's value changes.
For the
OnValueChange field you can specify a function that will be called when the slider's value changes. The easiest way to see this in action is to add a
UILabel, drag & drop the Label's game object into the Notify field and then choose the UILabel.SetCurrentPercent function from the drop-down list.
Pro-TipYou can use
UIStretch on the foreground to make it adjust its own size to match the parent so that it automatically adjusts its size when you resize the background.
Class Documentationhttp://tasharen.com/ngui/docs/class_u_i_slider.htmlIf you have a question regarding this component or would like me to clarify something, just post a reply here.