Unreal Engine 5 · Blueprint → C++
Get Game Instance in Unreal Engine 5 C++UE Docs
Get Game Instance maps to GetGameInstance() in C++, returning the UGameInstance that persists for the whole session. UGameplayStatics::GetGameInstance(this) is the static equivalent.
Blueprint node & C++ equivalent
UGameInstance* GI = GetGameInstance();
// or: UGameplayStatics::GetGameInstance(this)What is the Game Instance?
The UGameInstance is a single object that lives for the entire game session and survives level transitions, unlike actors or the game mode which are recreated per level. It is the standard place to store persistent state such as save data, player progress, or online session info.
The C++ equivalent
Actors, controllers, and many other classes expose a GetGameInstance() member that returns the current UGameInstance*. From a plain world context object, use UGameplayStatics::GetGameInstance(this) instead.
Cast the result to your custom subclass to reach your own members, for example Cast<UMyGameInstance>(GetGameInstance()). Always null-check the cast result before dereferencing it.
Frequently asked questions
How do I get the Game Instance in UE5 C++?+
Call GetGameInstance() from an actor or controller, or UGameplayStatics::GetGameInstance(this) from a world context object.
How do I access my custom Game Instance subclass?+
Cast the returned pointer with Cast<UMyGameInstance>(GetGameInstance()) and null-check it before using your custom members.
Does the Game Instance persist between levels?+
Yes. The UGameInstance exists for the entire session and survives level loads, making it ideal for persistent data.