Hi,
I’ve put together an inventory system that saves at checkpoints (based on a tutorial I found online). I’m trying to now create a method to delete the saved data when creating a new game.
How would I go about deleting the old data?
Here is my ItemSaveIO:
using UnityEngine;
public static class ItemSaveIO
{
private static readonly string baseSavePath;
static ItemSaveIO()
{
baseSavePath = Application.persistentDataPath;
}
public static void SaveItems(ItemContainerSaveData items, string path)
{
FileReadWrite.WriteToBinaryFile(baseSavePath + "/" + path + ".dat", items);
}
public static ItemContainerSaveData LoadItems(string path)
{
string filePath = baseSavePath + "/" + path + ".dat";
if (System.IO.File.Exists(filePath))
{
return FileReadWrite.ReadFromBinaryFile<ItemContainerSaveData>(filePath);
}
return null;
}
}