UGameplayStatics::SetGamePaused
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Pauses or unpauses the game. Returns true if the pause state was successfully changed.
Caveats & Gotchas
- • Pause only works on the server/standalone; calling it on a pure client has no effect unless the game mode allows client-side pause.
- • Actors with bTickEvenWhenPaused=true (and the corresponding UFUNCTION specifier) will continue ticking while paused — UI and cursor actors often use this.
- • The game mode's CanUnpauseBy() delegate can block unpausing, so a false return does not necessarily mean an error.
Signature
static ENGINE_API bool SetGamePaused(const UObject* WorldContextObject, bool bPaused); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to retrieve the world context. | — |
| bPaused | bool | True to pause the game, false to unpause. | — |
Return Type
bool Example
Toggle pause from pause menu C++
void UMyPauseMenuWidget::OnPauseButtonClicked()
{
bool bWasPaused = UGameplayStatics::IsGamePaused(this);
UGameplayStatics::SetGamePaused(this, !bWasPaused);
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?