diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 9bfef433..50b4e146 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -97,6 +97,7 @@ namespace NewHorizons private bool _playerAwake; public bool PlayerSpawned { get; set; } + public bool ForceClearCaches { get; set; } // for reloading configs public ShipWarpController ShipWarpController { get; private set; } @@ -196,7 +197,6 @@ namespace NewHorizons } }; - // why is this false when called in Start if (resetTranslation) { TranslationHandler.ClearTables(); @@ -289,8 +289,10 @@ namespace NewHorizons EnumUtilities.ClearCache(); // Caches of other assets only have to be cleared if we changed star systems - if (CurrentStarSystem != _previousStarSystem) + if (ForceClearCaches || CurrentStarSystem != _previousStarSystem) { + ForceClearCaches = false; + NHLogger.Log($"Changing star system from {_previousStarSystem} to {CurrentStarSystem} - Clearing system-specific caches!"); ImageUtilities.ClearCache(); AudioUtilities.ClearCache(); diff --git a/NewHorizons/Utility/DebugTools/DebugReload.cs b/NewHorizons/Utility/DebugTools/DebugReload.cs index 0f581ac8..87dc99cf 100644 --- a/NewHorizons/Utility/DebugTools/DebugReload.cs +++ b/NewHorizons/Utility/DebugTools/DebugReload.cs @@ -48,12 +48,8 @@ namespace NewHorizons.Utility.DebugTools SearchUtilities.Find("/PauseMenu/PauseMenuManagers").GetComponent().OnSkipToNextTimeLoop(); + Main.Instance.ForceClearCaches = true; Main.Instance.ChangeCurrentStarSystem(Main.Instance.CurrentStarSystem); - - NHLogger.Log($"Reloading configs for star system {Main.Instance.CurrentStarSystem} - Clearing system-specific caches!"); - ImageUtilities.ClearCache(); - AudioUtilities.ClearCache(); - AssetBundleUtilities.ClearCache(); Main.SecondsElapsedInLoop = -1f; }