Depends on how detailed the animation is. If it’s just a progress bar or numbers counting down, you could drive it by another actor’s tick / timeline and push the data into the widget.
While the off-screen widgets do not Tick, they can still be updated from the outside.
Hi! I was wondering if there was a way to force UMG animations to update even if they’re offscreen or invisible? I have a UMG sequence that simulates a timer. Sometimes, the widget being animated can be offscreen or be made invisible, and when that happens I still want the animation to continue playing as normal so that it resumes just-in-time when the widget is made visible again.
Unfortunately this won’t work as it’s a complex animation that’s authored in the sequencer timeline. This is also something that happens in multiple places of the UI, so I’m looking for a systemic fix rather than a bespoke one.
The right way to deal with “real world” timers is to decide on a clock to use, and then set a “finished time” based on that clock. The “value” of the timer is the constructed in the instant of examination by subtracting “current time” from “target time.”
Whether you use a real-world clock, an in-game clock, or some global variable you increment whenever the game is un-paused and your player pawn is possessed, or some other construct, depends on the game, but the core advice remains: Time comes from one place!
Saying “this is a timer that accumulates delta-T each time it ticks, and expires when it reaches 6 minutes” is the wrong way to go about it, for a variety of reasons; not just UI, pausing, and irregular frame rate, but also things like networking and testability are better served by standardizing on a single clock for all timers of the same type.
So, the way to do what you want, is to figure out what the clock is that you want to use. This could be some global that lives in some blueprint library, or could be one of the provided clocks in the engine itself. (Theres Now/DateTime, as well as Get Game Time, Get Audio Time, and so on.) Then, when you want to set a timer for 5 minutes from now, set the “at time” of the timer to “Now plus 5 minutes.” Then, for the timer display, derive the value to display (perhaps using data binding) from “time at expiry minus Now” and display that value. If you need to check whether the timer has expired, you can easily do that even if it hasn’t been updated for a while, by simply comparing “Now” to the “expiration time” value.