# Simple timer

**URL:** <https://forums.unrealengine.com/t/simple-timer/842126>\
**Category:** Blueprint\
**Tags:** timer, unreal-engine, Blueprint, question\
**Created:** [April 4, 2023, 3:40am UTC](https://forums.unrealengine.com/t/simple-timer/842126 "2023-04-04T03:40:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 4, 2023, 3:40am UTC](https://forums.unrealengine.com/t/simple-timer/842126/1 "2023-04-04T03:40:28Z")

</div>

I can’t find an answer to my question anywhere, so I’ll ask here.  
I have a game where the character must go from the beginning to the end of the entire map. At this time, there should be a timer, it shows how much time the player spent on passing it.  
The bottom line is that if my character dies, the timer should continue. Approximately as shown in the picture.  
 ![v78rKF5rtDk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/5/4a504ca4ffd3c5512b0b99b10e1cdaadabc1e669.jpeg)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 4, 2023, 4:51am UTC](https://forums.unrealengine.com/t/simple-timer/842126/2 "2023-04-04T04:51:46Z")

</div>

What exactly is the issue?  
If your game is single player, then just put a timer in the GameMode, start it at begin play or when you want it, stop and pause it when you want it and that’s it. It’s not affected by the player dying … unless you’re loading the map again, in that case, save the time, for example in the gameinstance, and then added it to the current time.

---

<div class="post-metadata">

**Author:** ![Leomerya12](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leomerya12/32/926321_2.png) [@Leomerya12](https://forums.unrealengine.com/u/Leomerya12)\
**Post date:** [April 4, 2023, 5:17am UTC](https://forums.unrealengine.com/t/simple-timer/842126/3 "2023-04-04T05:17:39Z")

</div>

I was going to say the same. I’m confused, because if you’re just starting out, everything seems difficult, but if you’re making a game, a timer is one of the easiest things to create.

Not sure what’s going on here.

It’s like baking a cake, but not knowing how to turn the oven on.

Maybe I/We are not understanding this person.

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 4, 2023, 8:01am UTC](https://forums.unrealengine.com/t/simple-timer/842126/4 "2023-04-04T08:01:06Z")

</div>

Excuse me sir, I’m begginer, maybe there’s a tutorial like this on tutorial sites?  
Or could you show how to do it yourself?

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 4, 2023, 9:39am UTC](https://forums.unrealengine.com/t/simple-timer/842126/5 "2023-04-04T09:39:39Z")

</div>

We still need to know more information.  
When the player dies, do you reload the level or respawn the player or reset the player?

Anyway, we start with some basic timer setup in the gamemode, that will count every second:

 ![img019](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/7/9d7cd6915b06eecc9de1ad11d35c1d7f554f9e63.jpeg)

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 4, 2023, 3:12pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/6 "2023-04-04T15:12:55Z")

</div>

after the character falls, the inscription “you died” appears and my character respawns at the position where he started his journey, while the level continues, it does not restart

I take an example from this game:  
[YouTube Video Game](https://youtu.be/aus_f5zO8U0) (from 1:34)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 4, 2023, 5:20pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/7 "2023-04-04T17:20:26Z")

</div>

Then is as it’s.  
You have your widget BP to which you’re going to send the current seconds:

 ![img021](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/8/6f866357ba3c577f5eef5a3e7e65d02062c20105.jpeg)

 ![img022](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/d/dcd50b6500deb95144b1c20c00ba1fde801128e2.jpeg)

And in your gameplay, you set your widget and your timer at the begin play, send the seconds to the widget at every second and when the player completes the level, stop the timer.

 ![img023](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/2/c/f2ca8fce58f6b226f4d70a40cac7b4f1481d1753.jpeg)

![img020](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/a/80af9ec73452f38037b013c4404da1ab4faf6484.jpeg)

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 4, 2023, 6:45pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/8 "2023-04-04T18:45:54Z")

</div>

Pardon my ignorance, sir, but did you add anything to the Event Graph in the widget itself

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 4, 2023, 7:12pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/9 "2023-04-04T19:12:51Z")

</div>

Yes. I created the function SetTimer, that takes the total seconds, calculates the minutes (=total seconds / 60) and seconds (=total seconds % 60) and updates the corresponding text widget.

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 4, 2023, 10:48pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/11 "2023-04-04T22:48:44Z")

</div>

This is my BP Game Mod:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/0/340d2ecd0680d8e24504351a5441d05e301915eb.png)

This is my Set Time

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/7/717c0542e6200ee0880a6ea6465daf32803bfb4e.png)

But he dont work ☹

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/7/a67d79eeb845ad897e31695dcf1ec6661b5fa8ce.jpeg)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 5, 2023, 2:14am UTC](https://forums.unrealengine.com/t/simple-timer/842126/12 "2023-04-05T02:14:24Z")

</div>

At begin play you are invoking a “Start Timer” function instead of “Start Time” custom event. What is “Start Timer” function doing? Does this function invokes “Start Time”?

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 5, 2023, 6:42am UTC](https://forums.unrealengine.com/t/simple-timer/842126/13 "2023-04-05T06:42:56Z")

</div>

I didn’t fully understand your question, but I followed your example. And at the end you have “Start Timer”

Also I get an error in “Custom Event” when I name it “StartTimer”.  
 ![2023-04-05_09-35-37](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/5/df5d0102e75fd45cfb1541382c926aef7a4852f8.png)

When I give it the name “StartTime” there is no error  
 ![2023-04-05_09-35-12](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/e/0feb07e37c47b939529b08ee581e0fe5d5646122.png)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 5, 2023, 7:06am UTC](https://forums.unrealengine.com/t/simple-timer/842126/14 "2023-04-05T07:06:50Z")

</div>

That’s because you already have a “StartTimer” function in the gamemode.

 ![img031](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/4/9c4d810fd1c3a0a1ba9398b77319c4b99be58d27.jpeg)

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 5, 2023, 7:32am UTC](https://forums.unrealengine.com/t/simple-timer/842126/15 "2023-04-05T07:32:41Z")

</div>

it is empty, apparently I created it by accident

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/4/dc4c9a157ac903aaead3cf4311dce16004849e3d.png)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 5, 2023, 6:16pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/16 "2023-04-05T18:16:16Z")

</div>

Delete that function and correct the gamemode. Is it working now?

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 6, 2023, 9:42am UTC](https://forums.unrealengine.com/t/simple-timer/842126/17 "2023-04-06T09:42:49Z")

</div>

Hello, unfortunately it did not work, I will try to achieve this process so that the timer works.

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 6, 2023, 12:17pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/18 "2023-04-06T12:17:12Z")

</div>

Finally, I did it, I just redid everything on a new one and it worked !!!  
Thank you very much, you are an expert in your field!  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/1/3e14a2790e13469ec87780b463688191fc33b807.jpeg)

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 6, 2023, 12:18pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/19 "2023-04-06T12:18:53Z")

</div>

How can i add hour value to make it work  
hours/minutes/seconds

I also added a variable to each. And it works too.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/d/f5d89143fc62b9392d7d0c8340169b6b163c2773.png)

I did this but don’t know if it will work, most likely I’ll have to wait 1 hour to find out 😄  
Also, I added another (/) to the “hours” value:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/c/94cd6e0b29b9877f96ad89c83927ebb49b35eabf.png)

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [April 6, 2023, 4:48pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/20 "2023-04-06T16:48:31Z")

</div>

First, there is no need to wait. To quickly test, you can just set the initial value of the timer to some value other than 0:

 ![img022](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/a/00abf4173d3c26cab111f9e28a6a97315aab740e.jpeg)

Second, to calculate the hours, minutes and seconds:

 ![img023](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/4/e34abcab4c13540e5c1aed9bb5de5172437fa45f.jpeg)

---

<div class="post-metadata">

**Author:** ![S1E4AN.TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s1e4an.tv/32/675585_2.png) [@S1E4AN.TV](https://forums.unrealengine.com/u/S1E4AN.TV)\
**Post date:** [April 6, 2023, 5:09pm UTC](https://forums.unrealengine.com/t/simple-timer/842126/21 "2023-04-06T17:09:38Z")

</div>

Thanks, your advice helped me a lot!

[Next page](https://forums.unrealengine.com/t/simple-timer/842126.md?page=2)
