// ============================================================================================= // Save public void Save() { List <int> costs = new List <int>(); List <bool> purchased = new List <bool>(); List <int> tiers = new List <int>(); foreach (Toggle toggle in toggles) { costs.Add(toggle.GetComponent <SkillTreeButton>().cost); purchased.Add(toggle.GetComponent <SkillTreeButton>().purchased); tiers.Add(toggle.GetComponent <SkillTreeButton>().tier); } SaveObject saveObject = new SaveObject { unlockedTier = unlockedTier, NumUnlockedT1 = NumUnlockedT1, NumUnlockedT2 = NumUnlockedT2, NumUnlockedT3 = NumUnlockedT3, NumUllockedT4 = NumUNlockedT4, NumT1ToUnlockT2 = NumT1ToUnlockT2, NumT2ToUnlockT3 = NumT2ToUnlockT3, NumT3ToUnlockT4 = NumT3ToUnlockT4, costs = costs, purchased = purchased, tiers = tiers, }; string json = JsonUtility.ToJson(saveObject); SaveSkillTree.Save(json); }