Advertisement
DynamicDonut

Untitled

Sep 7th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using UnityEngine;
  2. using LitJson;
  3.  
  4. public class GameManger : MonoBehaviour {
  5.     private JsonData questionData;
  6.  
  7.     bool foundQuestions;
  8.     WWW myWWW;
  9.  
  10.     // Use this for initialization
  11.     void Start() {
  12.         myWWW = new WWW("https://opentdb.com/api.php?amount=30&category=15&difficulty=medium&type=multiple");
  13.         foundQuestions = false;
  14.         questionData = JsonMapper.ToObject(myWWW.text);
  15.     }
  16.  
  17.     // Update is called once per frame
  18.     void Update() {
  19.         //if (myWWW.isDone && !foundQuestions) {
  20.         //    Debug.Log(myWWW.text);
  21.         //    foundQuestions = true;
  22.         //}
  23.  
  24.         Debug.Log(questionData["results"][0]["question"]);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement