public void addQuestion(Question question) { qContainer.Questions.Add(question); qContainer.Save(xmlPath); qCount++; nextID++; }
public static QuestionContainer loadQuestion(string path) { path = "file://" + Application.dataPath + "/Questions/" + path + ".xml"; Debug.Log(path); WWW file = new WWW(path); while (!file.isDone) { ; } if (!file.text.Equals("")) { XmlSerializer serializer = new XmlSerializer(typeof(QuestionContainer)); StringReader s = new StringReader(file.text); Debug.Log(file.text); return(serializer.Deserialize(s) as QuestionContainer); } else { QuestionContainer q = new QuestionContainer(); q.Save(Application.dataPath + "/" + path); return(q); } }