/// Awake this instance. void Awake() { // ensure only one instance of the canvas if (database == null) { //DontDestroyOnLoad (gameObject); database = this; } else if (database != this) { Destroy(gameObject); } dictionary = new Dictionary <string, string[]>(); dataFTF = new FindTheFishData(); // reinitialise each time as nothing can change at the current state. InitialiseQSRoot(); // QUICKSILVER ROOT SCENE if (File.Exists(Application.persistentDataPath + "/quicksilverRootData.dat")) { // load the data file LoadQS(); } /// FIND THE FISH SCENE // if a save file already exists, load it otherwise create and initialise a save file //if (File.Exists (Application.persistentDataPath + "/findTheFish.dat")) { // load the data file //LoadFTF (); //} else { // initialise the data file (first launch) InitialiseFTF(); //} }
/// <summary> /// Loads the find the fish data from file /// </summary> /// <returns>Returns 0 if error, 1 if successful</returns> public int LoadFTF() { if (File.Exists(Application.persistentDataPath + "/findTheFish.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/findTheFish.dat", FileMode.Open); dataFTF = (FindTheFishData)bf.Deserialize(file); file.Close(); return(1); } else { return(0); } }