Why would UI elelments only update when the game is *not* in focus?

I actually think I figured out what it was. The “ticks” in the engine were happening so fast while it was in focus and my regeneration was so slow/misprogrammed that there wasn’t enough time passing in between those ticks for even a single point of health to regenerate. But when it is out of focus the ticks are further apart so it was able to generate health.