I’m making a platformer that’s based on the collecting coins as fast as possible for each level. Currently, I’m using GameTime to track how long it takes the player to complete the level. This works mostly fine, but I have to do some funky stuff to get a good looking display of the time. Is there an easy way to track time up to 2 decimals, display it nicely in UMG and be in control of when it starts and stops? The issue with GameTime is that it starts when the level loads, but I’d like to have some sort of countdown to starting so the player can control when they start playing and the time counts. So far, I’ve found no good way of doing this.
to count up time (start , stop , pause ) here is 2 ways to do it , using Tick or using timers
and here is a time converter macro
Thanks for the quick reply. I gave the SetTimer (second example) a try and it worked the first time, but stopped working after that. Not sure what I’m doing wrong, but using the GetTimerElapsedTime node, it never starts. I’m viewing it while the game runs and it always returns 0.00000. Also, I tried a Branch and checked IsTimerActive to see if it was registering as an active timer. No dice. Does setting a timer automatically start it counting? I’ve tried to Clear, Set and Unpause on a BeginPlay node and still nothing happens. Here’s my setup…
&stc=1 &stc=1 &stc=1Hi Gooner44,
If you want a looping timer you need to check the looping checkbox on the “Set Timer” node.
I don’t want it to loop, just start when the level begins and allow the player to pause and unpause it. Does the timer function in BP only run one time, ever? That’s what it seems like it’s doing.
What I would do would be to store the GameTime at the time of “starting” into a variable. The “elapsed time” is then calculated as “the current time” minus the value of the variable.
Before the game time is stored in the variable, you’ll need a boolean variable or something to know to return “unknown” or “0” if the value is needed.
[=Gooner44;317842]
I don’t want it to loop, just start when the level begins and allow the player to pause and unpause it. Does the timer function in BP only run one time, ever? That’s what it seems like it’s doing.
[/]
In that case you will want a looping timer that runs into a gate. The gate will open when you press unpause and close when you press pause. The timer itself will remain constant, but the functionality will only run when you tell it to.