/// <summary> /// Callback when this instance is destroyed. /// </summary> public void OnDestroy() { ControlUnlock(); PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> (); config.load(); config.SetValue("CelestialBodiesWindowPos", _windowPos); config.save(); GameEvents.onHideUI.Remove(Hide); GameEvents.onShowUI.Remove(UnHide); GameEvents.onGamePause.Remove(Hide); GameEvents.onGameUnpause.Remove(UnHide); if (_instance == this) { _instance = null; } }