public static void LoadSettingsJson(bool regenConfig = false) { //If it doesn't exist, we need to gen a new one. if (regenConfig || !File.Exists(configFilePath)) { //Gen new config will autoload the new config. GenNewConfig(); return; } try { config = JsonUtility.FromJson <NSJsonSettings>(File.ReadAllText(configFilePath)); } catch (Exception e) { Debug.LogError(e); } isLoaded = true; foreach (var pendingAction in pendingActions) { pendingAction(); } pendingActions.Clear(); }
private static void GenNewConfig() { //Debug.Log("Generating new configuration file..."); NSJsonSettings temp = new NSJsonSettings(); config = temp; isLoaded = true; if (File.Exists(configFilePath)) { File.Delete(configFilePath); } File.WriteAllText(configFilePath, JsonUtility.ToJson(temp, true)); }