// Use this for initialization void Awake() { DontDestroyOnLoad(this.gameObject); if (manager == null) { manager = this; } else { Destroy(gameObject); } LifeQutoes = new List <Mood>(); PsyQuotes = new List <Mood>(); moodContainer mc = moodContainer.Load(path); foreach (Mood m in mc.moods) { LifeQutoes.Add(m); } foreach (Mood m in mc.ListPsy) { PsyQuotes.Add(m); } }
public static moodContainer Load(string path) { TextAsset _xml = Resources.Load <TextAsset>(path) as TextAsset; XmlSerializer serializer = new XmlSerializer(typeof(moodContainer)); StringReader reader = new StringReader(_xml.text); moodContainer moods = serializer.Deserialize(reader) as moodContainer; //moodContainer ListPsy = serializer.Deserialize(reader) as moodContainer; reader.Close(); return(moods); }