Count up timer

Hello, I’ve tried some codes but it doesn’t work, I’m not sure what kinda piece of code i should write, could someone help me? :slight_smile:

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

You can edit your post above.

Just in case this helps,

Cooldown timers, gun bullet intervals, shot spacing, rate of fire:

https://discussions.unity.com/t/821482/2

GunHeat (gunheat) spawning shooting rate of fire:

https://discussions.unity.com/t/824570/2

Thanks, but I mean just a timer on display like this: 00:00:00 while start game, timer would just count up, that’s what I mean, I need piece of code that do this, i don’t know how to do it, and I didn’t find it in intertnet

Get yourself some time value to compare to.
Usually this is Time.time, unless you need it, for example, unscaled.

currentTime = Time.time;

When you want your timer to start, remember the value, so startTime = currentTime.
Now for any given Update() cycle, the time that passed since your timer started is simply (currentTime-startTime).

This gives you a value in seconds. If you want it in a specific format, like HH:MM:SS, you gotta format it like that.
There is plenty of ressources on these things on the internet.

1 Like