AGameModeBase::IsPaused
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualconst
Description
Returns true if the game is currently paused. The game is considered paused when the internal `Pausers` delegate array is non-empty.
Caveats & Gotchas
- • Pause state is tracked server-side only; calling this on a client will always return false because the `Pausers` array is never replicated.
- • A game can be paused even if `bPauseable` is false — if `SetPause` was called directly (e.g. during a cinematic) the `Pausers` list will be populated regardless.
Signature
virtual bool IsPaused() const Return Type
bool Example
Conditionally show a pause menu C++
void AMyPlayerController::TogglePauseMenu()
{
AGameModeBase* GM = GetWorld()->GetAuthGameMode();
if (GM && GM->IsPaused())
{
// Resume and hide menu
GM->ClearPause();
HidePauseMenu();
}
else if (GM)
{
GM->SetPause(this);
ShowPauseMenu();
}
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?