UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SaveGame.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "UObject/Object.h"
9#include "SaveGame.generated.h"
10
11class ULocalPlayer;
13
22UCLASS(abstract, Blueprintable, BlueprintType, MinimalAPI)
24{
34};
35
36
39
46UCLASS(abstract, Blueprintable, BlueprintType, MinimalAPI)
48{
50public:
51
56 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
57 static ENGINE_API ULocalPlayerSaveGame* LoadOrCreateSaveGameForLocalPlayer(TSubclassOf<ULocalPlayerSaveGame> SaveGameClass, APlayerController* LocalPlayerController, const FString& SlotName);
58
63 static ENGINE_API ULocalPlayerSaveGame* LoadOrCreateSaveGameForLocalPlayer(TSubclassOf<ULocalPlayerSaveGame> SaveGameClass, const ULocalPlayer* LocalPlayer, const FString& SlotName);
64
69 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
70 static ENGINE_API bool AsyncLoadOrCreateSaveGameForLocalPlayer(TSubclassOf<ULocalPlayerSaveGame> SaveGameClass, APlayerController* LocalPlayerController, const FString& SlotName, FOnLocalPlayerSaveGameLoaded Delegate);
71
76 static ENGINE_API bool AsyncLoadOrCreateSaveGameForLocalPlayer(TSubclassOf<ULocalPlayerSaveGame> SaveGameClass, const ULocalPlayer* LocalPlayer, const FString& SlotName, FOnLocalPlayerSaveGameLoadedNative Delegate);
77
81 static ENGINE_API ULocalPlayerSaveGame* CreateNewSaveGameForLocalPlayer(TSubclassOf<ULocalPlayerSaveGame> SaveGameClass, const ULocalPlayer* LocalPlayer, const FString& SlotName);
82
87 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
88 ENGINE_API virtual bool SaveGameToSlotForLocalPlayer();
89
94 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
95 ENGINE_API virtual bool AsyncSaveGameToSlotForLocalPlayer();
96
97
99 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
100 ENGINE_API virtual APlayerController* GetLocalPlayerController() const;
101
103 ENGINE_API virtual const ULocalPlayer* GetLocalPlayer() const;
104
106 ENGINE_API virtual void SetLocalPlayer(const ULocalPlayer* LocalPlayer);
107
109 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
111
113 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
114 ENGINE_API virtual int32 GetPlatformUserIndex() const;
115
117 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
118 ENGINE_API virtual FString GetSaveSlotName() const;
119
121 ENGINE_API virtual void SetSaveSlotName(const FString& SlotName);
122
124 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
125 ENGINE_API virtual int32 GetSavedDataVersion() const;
126
128 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
129 ENGINE_API virtual int32 GetInvalidDataVersion() const;
130
132 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
133 ENGINE_API virtual int32 GetLatestDataVersion() const;
134
136 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
137 ENGINE_API virtual bool WasLoaded() const;
138
140 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
141 ENGINE_API virtual bool IsSaveInProgress() const;
142
144 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
145 ENGINE_API virtual bool WasLastSaveSuccessful() const;
146
148 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
149 ENGINE_API virtual bool WasSaveRequested() const;
150
151
153 ENGINE_API virtual void InitializeSaveGame(const ULocalPlayer* LocalPlayer, FString InSlotName, bool bWasLoaded);
154
156 UFUNCTION(BlueprintCallable, Category = "SaveGame|LocalPlayer")
157 ENGINE_API virtual void ResetToDefault();
158
160 UFUNCTION(BlueprintImplementableEvent, Category = "SaveGame|LocalPlayer")
161 ENGINE_API void OnResetToDefault();
162
164 ENGINE_API virtual void HandlePostLoad();
165
167 UFUNCTION(BlueprintImplementableEvent, Category = "SaveGame|LocalPlayer")
168 ENGINE_API void OnPostLoad();
169
171 ENGINE_API virtual void HandlePreSave();
172
174 UFUNCTION(BlueprintImplementableEvent, Category = "SaveGame|LocalPlayer")
175 ENGINE_API void OnPreSave();
176
178 ENGINE_API virtual void HandlePostSave(bool bSuccess);
179
181 UFUNCTION(BlueprintImplementableEvent, Category = "SaveGame|LocalPlayer")
182 ENGINE_API void OnPostSave(bool bSuccess);
183
186 ENGINE_API virtual void ProcessSaveComplete(const FString& SlotName, const int32 UserIndex, bool bSuccess, int32 SaveRequest);
187
190
194
197 FString SaveSlotName;
198
204 UPROPERTY()
205 int32 SavedDataVersion = 0;
206
211 int32 LoadedDataVersion = -1;
212
213
216 int32 CurrentSaveRequest = 0;
217
220 int32 LastSuccessfulSaveRequest = 0;
221
224 int32 LastErrorSaveRequest = 0;
225
226};
bool bSuccess
Definition ConvexDecomposition3.cpp:819
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:48
#define DECLARE_DYNAMIC_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:52
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
FName Tag const
Definition Actor.h:3810
Definition PlayerController.h:261
ENGINE_API FPlatformUserId GetPlatformUserId() const
ENGINE_API class ULocalPlayer * GetLocalPlayer() const
Definition SubclassOf.h:30
Definition SaveGame.h:48
Definition LocalPlayer.h:169
Definition Object.h:95
Definition SaveGame.h:24
Definition CoreMiscDefines.h:470
Definition ObjectPtr.h:488