diff --git a/SCANsat/SCAN_Unity/SCAN_UI_MainMap.cs b/SCANsat/SCAN_Unity/SCAN_UI_MainMap.cs index f7a3ce89..9103e699 100644 --- a/SCANsat/SCAN_Unity/SCAN_UI_MainMap.cs +++ b/SCANsat/SCAN_Unity/SCAN_UI_MainMap.cs @@ -88,6 +88,12 @@ public void OnDestroy() MonoBehaviour.Destroy(uiElement.gameObject); } + if (map_small != null) + { + GameObject.Destroy(map_small); + map_small = null; + } + GameEvents.onVesselSOIChanged.Remove(soiChange); GameEvents.onVesselChange.Remove(vesselChange); GameEvents.onVesselWasModified.Remove(vesselChange); @@ -769,7 +775,7 @@ private void drawBiomeMap(SCANtype type, bool apply) { bool biomeMap = data.Body.BiomeMap != null; - if (biomeBuilding) + if (biomeBuilding && biomeMap) buildBiomeCache(); if (scanline == 0 && TerminatorToggle)