Question by
Wren0900 · Feb 14, 2016 at 02:02 AM ·
updatesliderfixedupdate
How do I call a function when my slider is at max value?
Hello everyone, I have a horizontal sider that goes from 0-100. It's supposed to start at a random number and then increase to 100. My code is:
void start(){
charOneWait.GetComponent<Slider>().value = Random.Range(0, 100);
}
void FixedUpdate () {
charOneWait.GetComponent<Slider>().value += Time.deltaTime * 9;
}
My problem is I need an event to happen when the slider is at it's max value and I'm not sure where I should call that function. I can't call it in Start() because it needs to wait until the slider reaches 100. I can't call the function in update() or fixedupdate() because then the event is being called more than once.
Thanks in advance!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612064030im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Only Disable One Update on a Script 1 Answer
Score, FixedUpdate and Update 0 Answers
How to handle FixedUpdate() and Input 0 Answers
Addforce in fixedupate 0 Answers
Reduce framerate for server 1 Answer