private void LoadSaveTwo() { if (File.Exists(Application.persistentDataPath + "/shot2.save")) { ShotData2 shotdata = SaveSystemShot2.LoadShots(); EquippedShots = shotdata.Shots2; } else { return; } }
public static void SaveShots2(SpecialShots shot2) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/shot2.save"; FileStream stream = new FileStream(path, FileMode.Create); ShotData2 datashot = new ShotData2(shot2); formatter.Serialize(stream, datashot); Debug.Log("Shots Saved"); stream.Close(); }
public static ShotData2 LoadShots() { string path = Application.persistentDataPath + "/shot2.save"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); ShotData2 datashot = formatter.Deserialize(stream) as ShotData2; stream.Close(); //Debug.Log("Loading Shots"); return(datashot); } else { //Debug.LogError("savefileNotFound" + path); return(null); } }