diff --git a/NewHorizons/Builder/General/PlanetDestroyer.cs b/NewHorizons/Builder/General/PlanetDestroyer.cs index b2eab533..30f6d608 100644 --- a/NewHorizons/Builder/General/PlanetDestroyer.cs +++ b/NewHorizons/Builder/General/PlanetDestroyer.cs @@ -211,9 +211,14 @@ namespace NewHorizons.Builder.General HeavenlyBodyBuilder.Remove(ao); } - public static void RemoveDistantProxyClones() + public static void RemoveAllProxies() { GameObject.Destroy(GameObject.FindObjectOfType().gameObject); + + foreach(var name in _solarSystemBodies) + { + RemoveProxy(name.Replace(" ", "").Replace("'", "")); + } } private static void DisableBody(GameObject go, bool delete) @@ -233,6 +238,9 @@ namespace NewHorizons.Builder.General if (distantProxy != null) GameObject.Destroy(distantProxy.gameObject); if (distantProxyClone != null) GameObject.Destroy(distantProxyClone.gameObject); + + if (distantProxy == null && distantProxyClone == null) + Logger.Log($"Couldn't find proxy for {name}"); } } } diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index a6f0b738..f7e4a83d 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -102,7 +102,7 @@ namespace NewHorizons.Handlers Logger.Log("Done loading bodies"); // I don't know what these do but they look really weird from a distance - Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveDistantProxyClones(), 1); + Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies); if (Main.Instance.CurrentStarSystem != "SolarSystem") PlanetDestroyer.RemoveSolarSystem(); }