public void Dispose() { props.Clear(); types.Clear(); atr = null; }
private void Setup() { EditorFramework.currentEvent = Event.current; if (!initialized) { // SetupButtons(); List <FieldInfo> objectFields; FoldoutAttribute prevFold = default; var length = EditorTypes.Get(target, out objectFields); for (var i = 0; i < length; i++) { #region FOLDERS var fold = Attribute.GetCustomAttribute(objectFields[i], typeof(FoldoutAttribute)) as FoldoutAttribute; CacheFoldProp c; if (fold == null) { if (prevFold != null && prevFold.foldEverything) { if (!cacheFolds.TryGetValue(prevFold.name, out c)) { cacheFolds.Add(prevFold.name, new CacheFoldProp { atr = prevFold, types = new HashSet <string> { objectFields[i].Name } }); } else { c.types.Add(objectFields[i].Name); } } continue; } prevFold = fold; if (!cacheFolds.TryGetValue(fold.name, out c)) { var expanded = EditorPrefs.GetBool(string.Format($"{fold.name}{objectFields[i].Name}{target.name}"), false); cacheFolds.Add(fold.name, new CacheFoldProp { atr = fold, types = new HashSet <string> { objectFields[i].Name }, expanded = expanded }); } else { c.types.Add(objectFields[i].Name); } #endregion } var property = serializedObject.GetIterator(); var next = property.NextVisible(true); if (next) { do { HandleFoldProp(property); } while (property.NextVisible(false)); } initialized = true; } }