x


[Closed] CountDown Timer Help (Seconds problem)

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.

more ▼

asked Dec 31, 2011 at 09:09 AM

brandon199511 gravatar image

brandon199511
36 31 22 24

(comments are locked)
10|3000 characters needed characters left

The question has been closed Oct 23, 2013 at 01:15 AM by meat5000 for the following reason:

The question is self answered


2 answers: sort voted first

I fixed it before a moderator even approved the question.

CountDown Here: http://forum.unity3d.com/threads/117533-Timer-Help

more ▼

answered Dec 31, 2011 at 10:19 PM

brandon199511 gravatar image

brandon199511
36 31 22 24

(comments are locked)
10|3000 characters needed characters left

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)

more ▼

answered Dec 31, 2011 at 09:56 AM

Knightleaf gravatar image

Knightleaf
41 4 4 4

(comments are locked)
10|3000 characters needed characters left

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x866
x552
x116
x105
x61

asked: Dec 31, 2011 at 09:09 AM

Seen: 1568 times

Last Updated: Dec 31, 2011 at 10:19 PM