Using Timers While Game is Paused

I have a piece of text on my Paused Game UI that fades down, changes the content text, then fades back up. This loops every few seconds like a text-scroller. I’m doing this using an Event Timer and FInterp on the text’s opacity, and it works great, but it stops working if the game is paused. It never gets the call from the Timer firing (Which should debug print “Next Scroller”).

Is there a way to make a timer function while the game is paused? Alternatively, is there a better way to approach this kind of functionality for pause menus?

Here’s some pictures of my blueprints. SetupScroller() is called when UI is initiated, which sets the initial scroller text and starts the timer to call NextScroller() every 4 seconds. UpdateScroller() is called from Event Tick if ChangeScroller is true. Interpolates opacity down until it reaches 0, sets the text, then fades back up and sets ChangeScroller to false again.

Well, when you used Pause your game, it’s supposed to literally mean pause everything…BUT you can select which actors are paused when Pause happens.

So, to your specific dilemma however…Delays do not actually Pause after Game Pause… what I mean is, you can loop that delay for how long you’d want it for. It’s pretty hacky, but that’s the only way that I know of. Set a branch off after that delay so you can get out of the delay loop. The bool(true) being that game is unpaused.

To be honest, not sure if that would work, that’s the only way I know of hacking pause other than by unselecting Actors to be paused.

3 Likes

Thanks for the response Victor, you got me to take a step back and think about this from a different perspective, which took me out of the blueprints and to see there is animations built into the widgets system.

I was able to simplify my code a lot by using two animations on the opacity of my text, and binding events to when those animations finish. Apparently those animations run even while paused, and are actually probably a lighter-weight way of handling this specific challenge.

Here’s how I solved it:
I removed the UpdateScroller() as it was no longer needed.

Added a Scroller Fade Up Animation to animate opacity up

Scroller Fade Down Animation to animate opacity down after 2s of being full opacity

Simplified Construct and Tick, Simplified SetupScroller(), since I no longer need to check for animating

89082-new03.png

FadeDown() plays ScrollerFadeDown animation, which when finished goes to NextScroller() which sets the new text, and then calls FadeUp() which plays ScrollerFadeUp animation which when finished goes back to FadeDown() to loop it all together.

1 Like

Cool, glad I was somewhat of help :wink:

This man is a genius, the delay loop works, lifesaver.