/// <summary> /// Adds an element to the list. Will catch any exception in case of failure during the serialization. /// </summary> /// <param name="value"></param> public void Add(object value) { try { this.dataContainer.Add(UON.ToUON(value)); } catch (Exception ex) { InternalNGDebug.LogFileException(ex); } }
private void DrawFooter(Rect r) { r.y -= 3F; r.width = (r.width - 56F) / 2F; r.height -= 5F; if (GUI.Button(r, "Export") == true) { string path = EditorUtility.SaveFilePanel(Constants.PackageTitle, "", "profiles", "uon"); if (string.IsNullOrEmpty(path) == false) { File.WriteAllText(path, UON.ToUON(ProfilesManager.profiles)); } } r.x += r.width; if (GUI.Button(r, "Import") == true) { string path = EditorUtility.OpenFilePanel(Constants.PackageTitle, "", "uon"); if (string.IsNullOrEmpty(path) == false) { try { string uon = File.ReadAllText(path); List <Profile> importedProfiles = UON.FromUON(uon) as List <Profile>; ProfilesManager.profiles = importedProfiles; ProfilesManager.Save(); } catch (Exception ex) { Debug.LogException(ex); } } } }
void ISerializationCallbackReceiver.OnBeforeSerialize() { this.groupFiltersUON = UON.ToUON(this.groupFilters); }