using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using System.IO;
using UnityEngine;

class ResetSaveDataBeforeBuild : IPreprocessBuildWithReport
{
    public int callbackOrder => 0;

    public void OnPreprocessBuild(BuildReport report)
    {
        string path = Path.Combine(
            Application.persistentDataPath,
            "globaldata.json");

        if (File.Exists(path))
        {
            File.Delete(path);
            Debug.Log("Deleted globaldata.json before build");
        }
    }
}
