- Home /
Duplicate Question
http://answers.unity3d.com/questions/1230630/fill-slider-slowly-to-a-given-value.html#answer-1230712
increase/decrease the value of slider a little slowly
Hi...! I am using a slider in way a that a object catches another object and its according to value of other object my slider value changes accordingly. when slider value changes its handler goes directly to that value. I want to go slowly like its filling up, like we fill a water of glass in real life. Any Ideas how can I do it?
Sorry for bad English. Thanks in advance. :)
Answer by Mukabr · Aug 17, 2016 at 06:05 PM
Like this?
float timeToWait = 0.5f;
float fillQuantity = 0.1f;
public void Start()
{
StartCoroutine(FillSlider());
}
public IEnumerator FillSlider()
{
yield return new WaitForSeconds(timeToWait);
slider.value += fillQuantity;
StartCoroutine(FillSlider());
}
Won't this be calling itself again and again to infinity?
Follow this Question
Related Questions
Fill Slider slowly to a given value. 2 Answers
Shooting Cooldown Bar 2 Answers
Collision Updating UI Slider only once. 1 Answer
Left end of ui slider background flattens when moving handle to left 0 Answers