O'Reilly logo

Mastering Game Development with Unreal Engine 4 - Second Edition by Matt Edmonds

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required