{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Create Save Game Object in Unreal Engine 5 C++UE Docs

The Create Save Game Object node maps to UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()) in C++, which you then Cast to your USaveGame subclass.

Blueprint node & C++ equivalent

C++
UMySaveGame* Save = Cast<UMySaveGame>(
  UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));

What does the Create Save Game Object node do?

Create Save Game Object instantiates a fresh, empty save object of a class you derive from USaveGame. It does not touch disk; it only allocates the in-memory container whose UPROPERTY fields hold the data you intend to persist later with Save Game To Slot.

In Blueprints you pick the Save Game Class on the node. In C++ you pass that class explicitly through StaticClass().

CreateSaveGameObject C++ example

Call the static function and cast the result to your subclass: UMySaveGame* Save = Cast<UMySaveGame>(UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));. The cast is required because CreateSaveGameObject returns a base USaveGame*.

Your save class is a normal UCLASS() deriving from USaveGame, with each value you want saved marked as a UPROPERTY(). Only reflected UPROPERTY fields are serialized.

When to use it in C++

Use this whenever you start a new save from scratch, for example a new game or a reset slot. If you instead want to read an existing save, use UGameplayStatics::LoadGameFromSlot, which already returns a populated object so you do not need to create one first.

Frequently asked questions

What is the C++ equivalent of Create Save Game Object in UE5?+

It is UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()), cast to your USaveGame subclass pointer.

Does CreateSaveGameObject write to disk?+

No. It only allocates an empty save object in memory. You must call UGameplayStatics::SaveGameToSlot afterward to write it to disk.

Why do I need to Cast the result?+

CreateSaveGameObject returns a base USaveGame*, so you Cast it to your subclass to access your own UPROPERTY fields.

Related Save & Load nodes

View all Save & Load nodes →