The question is self answered
I am trying to make a count down timer from 3 to 0 by seconds. The timer will be displayed on screen. Problem is, I cant find a way to call the timer to run threw a function only once. Instead it calls every single frame.
Here is a list of things I have already tried but failed: InvokeRepeating <- cant seem to get a Time.deltaTime to run when it is called every frame Store variable - variable-- <- Obviously didnt work, but you got to try everything before posting right? Functions <- Didnt work as the function can not be called only once, instead it is called every single frame And much much much more (over 5 hours of trying to get it to work)
Other Info: I am doing this when you dont have enough money it states you don''t have enough and shows the time until automatic cancel.
I feel soooo dumb as this sounds stupid easy, but all in all. I cant find out how to make it run with Time.deltaTime or just run once in a function.
Answer by brandon199511
Dec 31, 2011 at 10:19 PM
I fixed it before a moderator even approved the question.
CountDown Here: http://forum.unity3d.com/threads/117533-Timer-Help
Answer by Knightleaf
Dec 31, 2011 at 09:56 AM
what is it for?
you could create a separate variable called cooldown, give it a time of 3 seconds create a function to store your timer have it start at your cooldown variable and when it reaches 0 it goes into your if statement
( all in all, try and implement it outside of the update loop, maybe on start or awake? depending on what you are doing because without knowing what setting its in or seeing the code its kind of hard to give a straight answer :D)
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
6 People are following this question.
Can anyone tell how can i add 2 seconds to my TIMER from another script ?
Format String Minutes:Seconds
how to make a varied countdown timer
Stop and Resume Timer
Countdown Timer Help About putting 0's