Author Topic: UISlider: How to get index of current step (if Steps is more than 0)?  (Read 2530 times)

3d03

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
I'm trying to get current step index, but it's difficult because of float-to-int, float-div-float math.round-float issues.
Please help.

sorry for my english.



3d03

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UISlider: How to get index of current step (if Steps is more than 0)?
« Reply #1 on: January 22, 2014, 05:51:41 PM »
Yes! I did it!)

index = (int) Mathf.Lerp (1, slider.numberOfSteps,slider.value);

Anadin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Super Useful - thanks!