public static void SaveDataToInventoryAltar(CharacteristicsHero characteristicsHero) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.dataPath + "/data/InvAL.sav", FileMode.Create); DataToInventoryAltar data = new DataToInventoryAltar(characteristicsHero); bf.Serialize(stream, data); stream.Close(); }
public static string[] LoadDataToInventoryAltar() { if (File.Exists(Application.dataPath + "/data/InvAL.sav")) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.dataPath + "/data/InvAL.sav", FileMode.Open); DataToInventoryAltar data = bf.Deserialize(stream) as DataToInventoryAltar; stream.Close(); return(data.Altar); } else { return(new string[0]); } }