[Windows] application lifecycle delegates

Hi guys! Is there any relevant application lifecycle delegates that we can use to capture windows entering background and entering foreground?

I tried all these, but none of them works on windows.

FCoreDelegates::ApplicationWillDeactivateDelegate
FCoreDelegates::ApplicationHasReactivatedDelegate
FCoreDelegates::ApplicationWillEnterBackgroundDelegate
FCoreDelegates::ApplicationHasEnteredForegroundDelegate

Unreal Engine: 5.3
Test Environment: Windows 10, Windows 11.

1 Like

Found anything out about this?

What else would one use to detect if focus has been regained when it’s paused?

Looks like OnWindowFocusChanged is doing the trick. Found it via:

I have put UGameplayStatics::SetGamePaused(GetWorld(), true); instead of setting the max fps.

Just make sure to add the following includes:

include <Kismet/GameplayStatics.h>
include “Framework/Application/SlateApplication.h”

and you can put this in any component for example. I put it in a dedicated component that I added to my character blueprint and it seems to work as intended. It pauses when alt tabbing and unpauses when going back :slight_smile: