void Awake() { if (Instance == null) { Instance = this; } if (Application.isEditor) { dataPath = Application.dataPath + "/../Arcade-Temp"; } else { dataPath = Application.dataPath + "/.."; } persistentDataPath = Application.persistentDataPath; fullArcadeVersionPath = persistentDataPath + "/Arcade_Data/" + arcadeInfoFileName + ".json"; if (File.Exists(fullArcadeVersionPath)) { arcadeVersion = Load(fullArcadeVersionPath); version.text = arcadeVersion.currentVersion.ToString(); } else { Save(); } }
ArcadeVersion Load(string path) { JsonData data = JsonMapper.ToObject(File.ReadAllText(path)); ArcadeVersion arcadeVersion = new ArcadeVersion(); arcadeVersion.currentVersion = (string)data["currentVersion"]; arcadeVersion.latestVersion = (string)data["latestVersion"]; currentVersion = arcadeVersion.currentVersion; return(arcadeVersion); }