UnityGameProjectsCode / RelianceGame / Save Data Control / DeleteSaveFile.cs
DeleteSaveFile.cs
Raw
using UnityEngine;

public class DeleteSaveFile : MonoBehaviour
{
    SaveFileManager saveMgr;
    DataPanelInfo panelInfo;
    ActivateBlocker blocker;
    private string fileName;

    private void Awake()
    {
        saveMgr = GameObject.Find("Persistent Object").GetComponent<SaveFileManager>();
        panelInfo = GetComponent<DataPanelInfo>();
        blocker = GameObject.Find("Continue").GetComponent<ActivateBlocker>();
    }

    private void Start()
    {
        fileName = panelInfo.fileNameText.text;
    }

    public void OnDeleteSave()
    {
        saveMgr.RemoveSaveFile(fileName);
        blocker.CheckSaves();
        Destroy(gameObject);
    }
}