- Home /
Making cooldown time of the skill
I am trying to make my first mobile game and make a cooldown time to the skill using UI button. The things I want to do is after i pressed the UI button, the skill function will be called(is finished), and then wait for few seconds the skill can be used again. The way that I was used is using button onClick and when it clicked the skill will be used. Now, if i pressed the button many times the skill will happen many times, so I want to set a timer to count the cooldown time for the function will be called next times. I find some video on youtube, most of them is putting the cooldown timer on the update function and if the cooldown time go to zero and input.getkeydown(xxx) then the skill can be use again. However, I want to use UIbutton instead of the key on the keyboard or mouse. Please help me TT, thank you.
Answer by seandolan · Feb 10, 2018 at 02:11 PM
You can add a script to the button to disable it for a fixed amount of time. The problem is when you disable the button, the script will not continue to run. What you need is in the following answer:
https://answers.unity.com/questions/896755/enabledisable-game-objects-after-wait-for-seconds.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612152328im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cooldown Function Problem 1 Answer
Adding a Cooldown to a C# script 2 Answers
Moving a gameobject x time every x time 1 Answer
Cooldown on a spell, and make full animation. 1 Answer
Cooldown/Timer system (Javascript) 0 Answers