# 2 timers, allow 1 to run while game is paused?

**URL:** <https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475>\
**Category:** Blueprint\
**Tags:** gamemode, timers, pause-game, gamestate, unreal-engine, question, Blueprint\
**Created:** [January 23, 2023, 5:50pm UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475 "2023-01-23T17:50:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 23, 2023, 5:50pm UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/1 "2023-01-23T17:50:00Z")

</div>

Hey all, need a bit of guidance figuring out how to approach this.

When my game loads I have a Set Game Paused (true) in my GameMode. After that, I load a MainMenu widget.  
I also have a Countdown Timer here (that ends the game when it runs out), that I only want to run when the game is unpaused:

 ![gm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/3/5632ba49f60b9c62ffbd52e0b0e1f8099502addb.jpeg)

In my GameState, I have a Set Timer By Function Name, that I would like to be able to run, After the MainMenu is closed and when the HUD (widget) EventConstruct kicks in.

 ![gs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/9/b/19b2451d62fa16f8a85fdb13246c11ec455cad4d.jpeg)

This is where I would like for it to kick in, before the game is unpaused:

 ![gs-ui](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/b/3cb51639b2d113601c0fc9d243b6e47d878a1d30.jpeg)

Basically, close the MainMenu, put the HUD up, let the user see the level while paused, have a 3,2,1, Go counter and unpause the game and let the user play, (and have the game mode timer starting). How can this be achieved?

As always, any tips are greatly appreciated

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 1:29am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/2 "2023-01-24T01:29:31Z")

</div>

Hey @cnapsys!

I think these might be the nodes you’re looking for! You might need that timer to be set by handle instead of function though.

> **[Pause Timer by Handle](https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/Time/PauseTimerbyHandle/)**
>
> Pause Timer by Handle

> **[Unpause Timer by Handle](https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Utilities/Time/UnpauseTimerbyHandle/)**
>
> Unpause Timer by Handle

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 1:40am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/3 "2023-01-24T01:40:11Z")

</div>

@Mind-Br thank you for taking the time to answer.  
If I do that… I assume I can pause the main timer and unpause it when I want to, but that means the game would have to be unpaused while the widgets are up, correct? This means that my player can use his/her action inputs, which I don’t want them to. Is there a way to not give them access to their controls until the 3,2,1, Go timer is finished?

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 1:43am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/4 "2023-01-24T01:43:35Z")

</div>

Absolutely! On begin play, probably on your GameMode or Level BP, use “GetPlayerController” into “DisablePlayerInput”, then as you start the timer, wherever it is you’re starting that use “GetPlayerController” into “EnablePlayerInput” 🙂

**Edit: Phrasing for readability**

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 1:44am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/5 "2023-01-24T01:44:30Z")

</div>

@Mind-Brain oh my… could it be that easy??? 🙂 tryin’ it right now

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 1:56am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/6 "2023-01-24T01:56:20Z")

</div>

@Mind-Brain Hmmmm, I do not have a DisablePlayerInput only DisableInput (Target Actor), If I use that it disables all input, for widgets too, so the player can’t click on the menu buttons). Sigh… I’m losing my mind

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 1:58am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/7 "2023-01-24T01:58:27Z")

</div>

Ah I didn’t realize you’d be working with a widget while it was waiting to start.

Use this then!

> **[Set Input Mode Game And UI](https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Input/SetInputModeGameAndUI/)**
>
> Set Input Mode Game And UI

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:00am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/8 "2023-01-24T02:00:26Z")

</div>

@Mind-Brain Ok, but do I use this while the game is still paused??? Or should I not set it to paused in my gamemode?

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 2:02am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/9 "2023-01-24T02:02:24Z")

</div>

You should still be able to interact with widgets while paused, as far as I know. Unless you’re doing something I’ve never seen before. Pause just stops ticks typically unless it’s really in-depth. You should just be able to use that once right before the pause, and once right after the unpause to set it back to “Game”.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:10am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/10 "2023-01-24T02:10:38Z")

</div>

@anonymous_user_31f0540d1, so In my GameMode, I pause the game and set the Input Mode to Game Only, then I load the MainMenu.  
On EventConstruct, I change the Set Input Mode to UI only like so…

 ![gm-mm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/2/1e2215f608b304aaf1700f0f0edc43af079d3c3a.jpeg)

When MainMenu loads, I have no Player Input and no mouse cursor???

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:17am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/11 "2023-01-24T02:17:57Z")

</div>

wow, I need some sleep… forgot to connect that Set Input Mode to UI only 🤣

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:18am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/12 "2023-01-24T02:18:38Z")

</div>

But now, both timers are paused as soon as I hit Play ☹

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 2:18am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/13 "2023-01-24T02:18:52Z")

</div>

Try this:

Open your project settings. Do a search for “viewport properties” and change the dropdown from “capture permanently” to “capture on mouse down”! Give that a shot and get back to us! 🙂

Edit: Okay, I thought that was there on purpose when you were fiddling with it lol

I’m confused as to why you’re pausing the game before launch of the gameplay. There’s no reason you should have to do that? If you want a countdown, don’t allow the timer to start or the player to be allowed input until the countdown ends. But if you pause the game, that’s it, the entire time function has stopped. All timers will pause.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:29am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/14 "2023-01-24T02:29:05Z")

</div>

@Mind-Brain ok, here’s what I was trying to do… when the game loads, I’m loading a MainMenu, that has a loading screen and then a MainMenu with buttons. When You hit play, the menu closes and it loads the HUD, if I don’t pause the game both timers start right away while the menu is up for the user. My reasoning was to pause the game, and when the user hits play start a 3 second countdown and then start the 1 min timer for each level. if you can’t complete the level in 1 min the game ends.  
How else, can I achieve this???

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 2:31am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/15 "2023-01-24T02:31:06Z")

</div>

I.e. if I unpause the game before I load the HUD (widget) both timers start ticking simultaneously.

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 2:47am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/16 "2023-01-24T02:47:04Z")

</div>

I think we can set that up with some minor alterations. Basically, just use Custom Events 😛  
Have the widget GetGamemode, CastTo(name of yourGameMode), “StartTimerEvent”. Then once that timer completes, have it run other Custom Events, like “LevelTimer” and such. If you need more assistance, can you show your countdown timer?

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 3:32am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/17 "2023-01-24T03:32:45Z")

</div>

@Mind-Brain

Here’s all I got so far:

GameMode:

 ![gm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/3/5632ba49f60b9c62ffbd52e0b0e1f8099502addb.jpeg)

GM Countdown Timer function:

 ![gm-cd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/3/2f3f09aa64071f31ffbd88ef26130270f1a34f0e.jpeg)

GameState:

 ![gs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/c/00cd3fd889965f0c40566870c6eddbd408cd8b59.jpeg)

MainMenu, that is Loaded from GameMode after game is paused:

 ![mm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/c/afc2a32d21ff19af3e83563dfbdf11dc7cd202c4.jpeg)

When clicking the PlayBtn inside the MainMenu: (Here, if I unpause the game, the timers both start ticking fine.)

 ![mm2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/6/de6a95c4e6d3d082b92528f31f18ee78451a55e6.jpeg)

The HUD which is loaded after the MainMenu is removed from Parent:

 ![hud1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/7/417923001d4d9f2343d3836528e9fe03c1d52e98.jpeg)

HUD continued custom event:

 ![hud2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/3/2e3af71226888cf33ce8660e814fdb6e6e0e53d2.jpeg)

HUD tick for setting the timer variables from GM:

 ![hud3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/5/245922c1cf98c0881a785172aaad30508af194f8.jpeg)

---

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [January 24, 2023, 3:56am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/18 "2023-01-24T03:56:09Z")

</div>

Ah. So there’s a few things I see.

I noticed your main menu is not a separate level. Typically it would be, but that’s fine, no biggie and no reason to change that. 🙂

Have you tried moving the “Remove From Parent” to the end of that line? If I remember correctly that needs to be at the end of things done by that widget.

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 3:57am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/19 "2023-01-24T03:57:54Z")

</div>

@Mind-Brain Oh, I’m using remove from parent there because I’m hiding the MainMenu on clicking Play… then I put another widget up called HUD, and that’s when I want the timers to kick in one after another.  
At that point the game is ready to play… would like to give the player a heads-up countdown… 3,2,1, Go and then let him play 🙂

---

<div class="post-metadata">

**Author:** ![cnapsys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cnapsys](https://forums.unrealengine.com/u/cnapsys)\
**Post date:** [January 24, 2023, 3:59am UTC](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475/20 "2023-01-24T03:59:05Z")

</div>

> [@Mind-Brain](#):
>
> I noticed your main menu is not a separate level. Typically it would be, but that’s fine, no biggie and no reason to change that. 🙂

Yes, I’m still learning… will probably end up putting the MainMenu in its own level… but for now, I’m just taking it all in and figuring things out…

[Next page](https://forums.unrealengine.com/t/2-timers-allow-1-to-run-while-game-is-paused/755475.md?page=2)
