void loadProblems() { FPSInputController json = GameObject.Find("Player").GetComponent("FPSInputController") as FPSInputController; TextAsset textFile = (TextAsset)Resources.Load("Level2Problems", typeof(TextAsset)); Hashtable[] parsed = (Hashtable[])json.parse(textFile.text); print(parsed.Length); foreach (Hashtable hash in parsed) { problemList.Add(Problem.deserialize(hash)); } }
// Use this for initialization void Start() { questionList = new ArrayList(); Controller = GameObject.Find("Controller").GetComponent("GameController") as GameController; FPSInputController json = GameObject.Find("Player").GetComponent("FPSInputController") as FPSInputController; TextAsset textFile = (TextAsset)Resources.Load(QuizName, typeof(TextAsset)); Hashtable[] parsed = (Hashtable[])json.parse(textFile.text); foreach (Hashtable hashQuest in parsed) { Question q = new Question(); q.question = (string)hashQuest["question"]; q.answers = (string[])hashQuest["answers"]; q.correctAnswer = (string)hashQuest["correct"]; q.hints = (string[])hashQuest["hints"]; questionList.Add(q); } }