//Load Data// public void Load() { string gameDataFile = GetDataPath() + "/" + dataFileName; if (xs.hasFile(gameDataFile)) { string dataString = xs.LoadXML(gameDataFile); GameData gameDataFromXML = xs.DeserializeObject(dataString, typeof(GameData)) as GameData; //Verify Success// if (gameDataFromXML.key == gameData.key) { gameData = gameDataFromXML; } //Verify Failed// else { //Todo } } else { if (gameData != null) Save(); } }
public void Awake() { gameData = new GameData(); //Key will be set by the device id// gameData.key = SystemInfo.deviceUniqueIdentifier; Load(); }