void SetActive(bool active) { var state = LoadState(); var wasExpanded = (state & State.WasExpanded) != 0; if (!active) { SetInspectorExpanded(wasExpanded); // Restore previous expanding state } if (active) { wasExpanded = InternalEditorUtility.GetIsInspectorExpanded(target); SetInspectorExpanded(true); // Always expand on tab activation } state = GetState(active, wasExpanded); PackagePrefs.Set <int>(GetPrefKey(), (int)state); inspector.propertyEditor.Repaint(); }
State LoadState() { return((State)PackagePrefs.Get <int>(GetPrefKey())); }