public void OnClick() { Profile p = new Profile(input.text); ProfileManager.AddProfile(p); ProfileManager.Save(); pList.RefreshDisplay(); Preferences prefs = new global::Preferences(); XMLManager.SavePreferences(prefs, p.GetId()); }
public static Preferences LoadPreferences() { if (File.Exists(Application.persistentDataPath + "/XMLFiles/Preferences/child" + Authentication.currentProfile.GetId() + "preferences.xml")) { Preferences resul; SPref temp; XmlSerializer serializer = new XmlSerializer(typeof(SPref)); FileStream stream = new FileStream(Application.persistentDataPath + "/XMLFiles/Preferences/child" + Authentication.currentProfile.GetId() + "preferences.xml", FileMode.Open); temp = serializer.Deserialize(stream) as SPref; stream.Close(); resul = new global::Preferences(temp); return(resul); } else { Preferences pref = new Preferences(); SavePreferences(pref); return(LoadPreferences()); } }