AGameModeBase::ForceClearUnpauseDelegates
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: ENGINE_API
Description
Unconditionally removes all CanUnpause delegates belonging to PauseActor and calls ClearPause if any were removed. Prevents the game from getting permanently stuck paused when the pausing actor is destroyed.
Caveats & Gotchas
- • This is called automatically by the engine when a PlayerController is destroyed. You rarely need to call it yourself unless you are manually managing pause state for non-PlayerController actors.
- • After removal the engine calls ClearPause() — if no other pause delegates remain, the game immediately unpauses. This can be surprising if you assumed the pause would persist until explicitly cleared.
Signature
void ForceClearUnpauseDelegates(AActor* PauseActor) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PauseActor | AActor* | The actor whose CanUnpause delegates should be unconditionally removed from the pause list. | — |
Return Type
void Example
Manually release pause when a UI widget is garbage collected C++
void UMyPauseWidget::BeginDestroy()
{
// Ensure the game unpauses if this widget is GC'd while paused
if (AMyGameMode* GM = Cast<AMyGameMode>(
GetWorld() ? GetWorld()->GetAuthGameMode() : nullptr))
{
GM->ForceClearUnpauseDelegates(GetOwningPlayerController());
}
Super::BeginDestroy();
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?