Save and load from our menu

Saving our data is relatively straightforward, but as with all load/save systems, is mirrored with a little more difficulty on the load side. This functionality is almost exclusively implemented in the MainMenuWidget class, though I can see that the class might grow, moving it to the SavedActorInterface or the like; but let's now go forward with what is done:

UCLASS()
class MASTERING_API UMainMenuWidget : public UUserWidget
{
        GENERATED_BODY()
        
public:
        UFUNCTION(BlueprintCallable)
        void LoadGame(FString SaveFile);
 
        UFUNCTION(BlueprintCallable)
        void SaveGame();
 
        UFUNCTION(BlueprintCallable)
        void Open();
 
        UFUNCTION(BlueprintCallable)
        void Close();
 
        UFUNCTION(BlueprintCallable)
        void PopulateSaveFiles();
 
        void OnGameLoadedFixup ...

Get Mastering Game Development with Unreal Engine 4 - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.