private static bool saveFile(uint filenumber,PlayerController player,DungeonInformation dginfo, DungeonParameterTable dgpramtable) { if (filenumber >= filename.Length) throw new ArgumentOutOfRangeException(); string savepath = savedir + @"\" + filename[filenumber]; LocalSaveData lcs = new LocalSaveData(); lcs.setPlayerData(player); lcs.setDungeonData(dginfo,dgpramtable); lcs.setGlobalGameInformation(GameController.GlobalGameInformation); string json = JsonUtility.ToJson(lcs,true); Debug.Log(json); using (FileStream fs = new FileStream(savepath, FileMode.Create, FileAccess.Write)){ BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, json); return true; } return false; }