Yep, you can check if any save file exists in the SaveGames folder in Unreal Engine by using the file management functionalities provided by the engine.
Here’s a quick snippet:
#include "HAL/FileManager.h"
bool DoesSaveGameExist()
{
IFileManager& FileManager = IFileManager::Get();
// Construct the path to the SaveGames directory
FString SaveGamesDirectory = FPaths::ProjectSavedDir() + TEXT("/SaveGames/");
// Array to hold the names of found files
TArray<FString> FoundFiles;
// Search for any files in the SaveGames directory, excluding directories
FileManager.FindFiles(FoundFiles, *SaveGamesDirectory, *FString("*.*"));
// If FoundFiles is not empty, then there are save files present
return FoundFiles.Num() > 0;
}
This function will return true if there are any files in the SaveGames.