public static void SaveOnDisc(StartBattleSettings toSave) { BinaryFormatter bf = new BinaryFormatter(); //Application.persistentDataPath is a string, so if you wanted you can put that into debug.log if you want to know where save games are located FileStream file = File.Create(Application.dataPath + saveFile); //you can call it anything you want bf.Serialize(file, toSave); file.Close(); Debug.Log("Saved in " + saveFile); }
public StartBattleSettings() { Debug.Log("Initializing StartBattleSettings..."); singleton = this; try { var n = SaveLoadStartBattle.LoadFromDisc(); if (n != null) { singleton = n; } } catch (Exception e) { Debug.Log(e); } }