RealDocs

AGameModeBase::AllowPausing

function Engine Since 4.14
#include "GameFramework/GameModeBase.h"
Access: public Specifiers: virtual

Description

Returns true if the game allows pausing. Override to restrict pause access to specific controllers or game states.

Caveats & Gotchas

  • The base implementation simply returns the value of the protected `bPauseable` flag; if you override without consulting it you may silently break single-player pause even when `bPauseable` is false.
  • This is only called on the server — clients cannot unilaterally pause a multiplayer session and should not rely on this returning true on their side.
  • Returning false here does not un-pause a game that is already paused; call `ClearPause()` separately if needed.

Signature

virtual bool AllowPausing(APlayerController* PC = nullptr)

Parameters

Name Type Description Default
PC APlayerController* The player controller requesting to pause, or nullptr to check globally. nullptr

Return Type

bool

Example

Allow pause only for the host player C++
bool AMyGameMode::AllowPausing(APlayerController* PC)
{
    // Only allow the listen-server host to pause
    if (PC && PC->IsLocalController())
    {
        return Super::AllowPausing(PC);
    }
    return false;
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.