- Home /
Slider with multiple labels
I'm trying to develop a slider that looks a little something like this:
The idea is that there's a timeline that can range from 2021 to X, and I need the labels on top to dynamically recalculate themselves to be accurately placed on the timeline, and also be in increments of 10. So if the timeline is from 2021 to 2050, I should have 4 labels that say 2020, 2030, 2040 and 2050. If the timeline is from 2021 to 2070, there should be 6 labels instead.
The idea I had was to instantiate labels as prefabs in a container in the same size and position as the timeline, and have a horzontal layout group on it, and instantiate a number of prefabs equal to the Slider.maxValue - Slider.minValue / 10. Assuming that the layout group spaces them out evenly, they should hopefully line up correctly on the timeline.
Is there a better way to do this? I've seen plenty of tutorials about putting a single label on the slider (on the handle), but nobody seems to be labeling the slider data range (aside from the start and end).
Your answer
Follow this Question
Related Questions
How to put a image under a powerbar's handle thats moving? 0 Answers
UI Callout-Label for Parts of a 3D Model?? 1 Answer
Dynamic slider size with the new UI 2 Answers
left end of slider fill flattening the more i move the value down 0 Answers
Why hip will move upward and downward automatically when start to drag slider at x,y and z axis? 0 Answers