How can I add a Countdown Timer to a Level with Blueprints (e.g. Time Limit to complete a Level)

I’m having trouble trying to create a countdown timer with Blueprints. As I’m not sure where to start with it.

I’m trying to create a timer that can be placed into individual levels, and will display on the Player’s HUD, the time remaining. (The reason I’d like it to be placeable and editable into different levels is that different levels will have different times required to complete them).

What I’m aiming to create is a time limit to complete the level, If the timer hits “0”, then a “Game over” with a “Restart” button appears.

Any help with this would be absolutely appreciated, Thanks!

I would use timeline for that, here’s an example :


I thought there was a node for that, but I couldn’t find it.

But time line should work fine.

Good luck !

I can’t quite see where I can enter or change the time for the levels, Also Would this display the Time in mm:ss or just seconds?

Could you show how you made the custom event please? Thank you very much for replying!

Enjoy. This is my simple timer with 2 functions and 2 events. First event is for each tick and second is called when time is up.
On TimeIsUp event you can clear the timer(we saved a handle for it) to stop ticking or you can restart it(otherwise this event will keep firing)

Also you can use EventDispatchers instead of simple events to bind multiple events to it:

On the left there is a node “make literal float” , You will need a variable there, thats the start time.

About setting Your time in the level, You could make an actor to CoundDown with Start time variable that is editable, than it would be possible by seting the time in that actor details. Probably the simplest one

Other better way, but not that simple would be calling CountDown in game instance blueprint

You would need to set map index when changing the map.
It’s much better, because you would have all times in one place

On the right side there is a node called “Time Seconds to String” it changes seconds to mm:ss:ms

To create custom event → right click “custom event”

To call it → right click “call (event name)”

I believe that timeline is not a good way to create timers. You can have tons of timers and timeline nodes are evaluated each tick. So for example updating 100 timers 30+ times per second(3000 updates each second) isnt good for your performance. Timer events are really good for such purposes.Even 0.1s refresh rate can save you 2000 calls.

Well MikeyBGames will only need one timeline for his countdown, and timelines seems to be more accurate and easier to set up.

I just mean that timelines are made for a bit diffferent purposes. And about accuracy: by using a timer you can even create a floating refresh rate(when 90 secs remaining RR is 1update/sec, but when timer reaches 10s you can change RR to 10updates/sec etc). I believe its more flexible way for creating a timers. Also event dispatchers can be really useful when many BPs want to know about new second or about time expiration.
BUT timelines still can be used for some simple logic.

How do I create the “Cast To gm_mainMenu” in Level BP?