Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [System.Serializable]
- public class TextOfTweet
- {
- public string text;
- }
- [System.Serializable]
- public class RootObject
- {
- public List<TextOfTweet> tweetTexts;
- }
- public class MoveTweetDown : MonoBehaviour {
- private int thisSpeed;
- private void OnEnable()
- {
- thisSpeed = LevelManager.current.speedOfTweets;
- string path = Application.streamingAssetsPath + "/Covfefefiltered.json";
- string jsonString = File.ReadAllText(path);
- RootObject textForTweet = JsonUtility.FromJson<RootObject>(jsonString);
- Debug.Log(textForTweet.tweetTexts[0].text); //Error ArgumentOutOfRangeException here
- int randomTweetN = Random.Range(0, textForTweet.tweetTexts.Count);
- gameObject.GetComponentInChildren<TextMesh>().text = textForTweet.tweetTexts[randomTweetN].text;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement