public static void SaveIndexToList(TransitionBetweenModes transitionBetweenModes) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.dataPath + "/data/ITL.sav", FileMode.Create); SaveIndexList data = new SaveIndexList(transitionBetweenModes); bf.Serialize(stream, data); stream.Close(); }
public static int[] LoadIndexToList() { if (File.Exists(Application.dataPath + "/data/ITL.sav")) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.dataPath + "/data/ITL.sav", FileMode.Open); SaveIndexList data = bf.Deserialize(stream) as SaveIndexList; stream.Close(); return(data.IndexToList); } else { return(new int[0]); } }