public void OnDestroy() { if (FocusOverlay != null) { FocusOverlay.Dispose(); } if (ManeuverNodeOverlay != null) { ManeuverNodeOverlay.Dispose(); } if (FilterOverlay != null) { FilterOverlay.Dispose(); } if (Renderer != null) { Renderer.Detach(); } if (Network != null) { Network.Dispose(); } if (Satellites != null) { Satellites.Dispose(); } if (Antennas != null) { Antennas.Dispose(); } // Remove GUI stuff GameEvents.onShowUI.Remove(UIOn); GameEvents.onHideUI.Remove(UIOff); // addons if (ctrlLockAddon != null) { ctrlLockAddon = null; } if (kacAddon != null) { kacAddon = null; } Instance = null; }
/// <summary> /// Called by the Unity engine during the Decommissioning phase of the Engine. /// This is used to clean up everything before quiting. /// </summary> public void OnDestroy() { if (FocusOverlay != null) { FocusOverlay.Dispose(); } if (ManeuverNodeOverlay != null) { ManeuverNodeOverlay.Dispose(); } if (FilterOverlay != null) { FilterOverlay.Dispose(); } if (Renderer != null) { Renderer.Detach(); } if (Network != null) { Network.Dispose(); } if (Satellites != null) { Satellites.Dispose(); } if (Antennas != null) { Antennas.Dispose(); } // Release all RT locks currently engaged ReleaseLocks(); // Remove GUI stuff GameEvents.onShowUI.Remove(UiOn); GameEvents.onHideUI.Remove(UiOff); // add-ons if (KacAddon != null) { KacAddon = null; } Instance = null; }