public void Save() { SavePlayerData sp = SavePlayerData.fromPlayer(this.player); string json = JsonUtility.ToJson(sp); Debug.Log(json); BinaryFormatter BinForm = new BinaryFormatter(); // creates a new variabe called "BinForm" that stores a "binary formatter" in charge of writing files to binary var path = Application.persistentDataPath + "/playerData.dat"; FileStream file = File.Create(path); //creates a file BinForm.Serialize(file, sp); // writes the "data" container to the file file.Close(); // closes file Debug.Log("Data Saved to " + path); //Load (); }