public void SaveGame() { FileStream file = File.Open(Application.persistentDataPath + "/controlInfo.dat", FileMode.Create); ConntrolData data = new ConntrolData(); data.keyMapping = KeyImputManager.KeyMapping; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, data); file.Close(); }
public void LoadGame() { BinaryFormatter bf = new BinaryFormatter(); if (!File.Exists(Application.persistentDataPath + "/controlInfo.dat")) { throw new Exception("Game file does not exist"); } FileStream file = File.Open(Application.persistentDataPath + "/controlInfo.dat", FileMode.Open); ConntrolData data = (ConntrolData)(bf.Deserialize(file)); KeyImputManager.KeyMapping = data.keyMapping; }