Beispiel #1
0
        public static DataState LoadData()
        {
            string path = Application.persistentDataPath + "/savestate.menu";

            if (File.Exists(path))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                FileStream      stream    = new FileStream(path, FileMode.Open);

                DataState data = formatter.Deserialize(stream) as DataState;
                stream.Close();

                return(data);
            }
            else
            {
                Debug.Log("Error not found!");
                return(null);
            }
        }