RealDocs

UGameplayStatics::GetGameInstance

function Engine Blueprint Since 4.4
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns the UGameInstance for the current world. Use this to access subsystems, persistent data, and anything scoped to the game session rather than a single level.

Caveats & Gotchas

  • Returns null in Editor utility contexts where no PIE world is active, and can return null in unit tests that construct a bare UWorld without a game instance — always null-check.
  • The game instance outlives individual levels; data stored on it persists through seamless travel and level transitions, making it the right place for session-wide state like inventory or player progression.

Signature

static ENGINE_API class UGameInstance* GetGameInstance(const UObject* WorldContextObject);

Parameters

Name Type Description Default
WorldContextObject const UObject* Any UObject with access to the world; used to locate the owning game instance.

Return Type

UGameInstance*

Example

Access a custom game instance subsystem C++
UMyGameInstance* GI = Cast<UMyGameInstance>(
    UGameplayStatics::GetGameInstance(this));
if (GI)
{
    GI->SavePlayerProgress(PlayerData);
}

Version History

Introduced in: 4.4

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.