Download

How to create a timer with a hud ?

So I would like to set a timer in my level , I have done that easely with a event tick and “get game time in second” node with a print string but its not what I want.
Sans titre 2.png
I want it to look like that , set dynamically the time in this text box ( set like that : minutes:seconds:milliseconds ) and to start when the level begin and end when I enter in a precise trigger box.

@misterrider , Here is a way to do it :

test250.PNG

Is this made in the HUD BP? How do i get the update timer text?

You have to bind the text to the variables. Go on the text of the timer, and bind the text with the variable.

Thank you! Now how can i get Seconds in that Update Timer? And where do i get that last SetText?

click on the text of the HUD and click bind and select the variable

I am missing something. I clicked TimerText text of the HUD and made it variable. When I click bind, it gives me create binding and then creates a function and I have no idea what i am doing. I have spent two weeks trying different tutorials to make a timer for platformer with milliseconds and upward going time, but no luck.

Learn how to bind. Create a fuction and as variable bind the time. You have only to collegate pins

So I finally managed to make the timer. Attached is a photo of the widget HUD blueprint to help others.

  1. Make widget HUD
  2. Add textblock -> bind -> create binding
  3. Make the blueprint like in the picture and you are good to go.

Now i need to learn how to stop timing at level end or at death and save the time to comparison. Any help for this?

i suggest to you to create a game istance and save the variable timer in there. Then you can get access to that variable in level too.

As Siengried said above in case someone comes across this in the future and building on the previous answer.

Create timer in game instance or game mode and then update widget from there…

  • to do this give the text a name and check the is variable checkbox
  • than drag off a cast to the widget or a stored ref of the widget and type get whatever you named the variable in the widget.
  • then set the text

As shown in the pics