public static void LoadSavedTexts() { string json = File.ReadAllText(Application.dataPath + "/BubbleTexts/bubbleTexts.txt"); BubbleTextContainer bubbleTextContainer = JsonUtility.FromJson <BubbleTextContainer>(json); BubbleTextCollection = bubbleTextContainer.BubbleTexts; BubbleTextFollowerCollection = new List <BubbleText>(); BubbleTextDissidentCollection = new List <BubbleText>(); BubbleTextFollowerCollection = bubbleTextContainer.FollowerbubbleTexts; BubbleTextDissidentCollection = bubbleTextContainer.DissidentbubbleTexts; }
public static void SaveSampleTexts() { BubbleText leaderSucks = new BubbleText("The leader sucks", false); BubbleText leaderGreat = new BubbleText("The leader is great", true); BubbleText likeLeader = new BubbleText("I really like the Leader", true); BubbleText hateLeader = new BubbleText("I really hate the Leader", false); BubbleText[] bubbleTexts = new BubbleText[] { leaderSucks, leaderGreat, likeLeader, hateLeader }; BubbleTextContainer textContainer = new BubbleTextContainer(bubbleTexts); string json = JsonUtility.ToJson(textContainer, true); File.WriteAllText(Application.dataPath + "/BubbleTexts/bubbleTexts.txt", json); }