Pause everything when game not in focus?

The console command t.IdleWhenNotForeground=1 will lower framerate and CPU usage when you’ve alt-tabbed out. You can then maybe use frame time to determine if you’re idling for a BP only solution.

Otherwise you can get a C++ function to detect lost focus, see this question for details.