top of page
tetrastudiosdev

Fixing Saving on Quest in UE5

I wanted to share this as I've seen a few devs run into this issue:


SaveGames

More recently, Unreal SaveGames have stopped working on the Quest entirely. This is due to the way Android has started dealing with file permissions - to cut a long story short, you're not allowed to store anything outside your game folder, without requesting permissions first.


Even when requesting permissions however, some files still won't save properly, notably the SaveGame. This is because it's pointing to a destination it's still not allowed to save at. To fix this, we need to do some quick engine modifications:


(Thanks to https://rassadin.net/android-external-storage-access/ for this code snippet! He goes into a lot more detail than I do here.)

//In Engine/Source/Runtime/Engine/Public/SaveGameSystem.H
//Starting at Line 166
virtual FString GetSaveGamePath(const TCHAR* Name)
    {
        FString SaveDir;
#ifdef USE_ANDROID_FILE
        extern FString GInternalFilePath;
        SaveDir = FString::Printf(TEXT("%s/SaveGames/%s.sav"), *GInternalFilePath, Name);
#else
        SaveDir = FString::Printf(TEXT("%sSaveGames/%s.sav"), *FPaths::ProjectSavedDir(), Name);
#endif
        UE_LOG(LogTemp, Warning, TEXT("Save game path: %s"), *SaveDir);
        return SaveDir;
    }
};

Saving Other Files

If you want to save other types of files, you will need to use the "Project Persistent Download Dir" node, and NOT the "Project Dir" node. This saves the files to Android -> Data -> com.YourCompany.YourApp -> files. I use this method to allow users to save their WorldWeaver files.


Please drop a like if you found this helpful!

24 views0 comments

Kommentare


bottom of page