RealDocs

UKismetSystemLibrary::QuitGame

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Exits the running game, either terminating the process or backgrounding the application depending on QuitPreference. This is the standard node behind a main menu's 'Quit' button.

Caveats & Gotchas

  • On many console platforms, quitting a game entirely is against platform certification requirements — QuitPreference::Background is used there instead, and bIgnorePlatformRestrictions is stripped out of shipping builds so it can't be abused to bypass that.
  • In the editor (PIE), this stops the play session rather than closing the editor process itself.
  • This does not fire EndPlay with EEndPlayReason::Quit synchronously before returning — cleanup happens as part of the normal shutdown sequence, so don't assume state is already torn down immediately after the call.

Signature

static void QuitGame(const UObject* WorldContextObject, class APlayerController* SpecificPlayer, TEnumAsByte<EQuitPreference::Type> QuitPreference, bool bIgnorePlatformRestrictions);

Parameters

Name Type Description Default
WorldContextObject const UObject* World context used to resolve the target player if none is specified.
SpecificPlayer class APlayerController* The player requesting the quit. If null, player 0 is used.
QuitPreference TEnumAsByte<EQuitPreference::Type> Whether to fully exit the application or just background it.
bIgnorePlatformRestrictions bool Ignores platform best-practices that normally prevent quitting (e.g. some consoles never allow it). Non-shipping builds only.

Return Type

void

Example

Quit from a menu button C++
UKismetSystemLibrary::QuitGame(this, PlayerController, EQuitPreference::Quit, false);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.