womp womp

This commit is contained in:
JohnCorby 2025-01-29 17:17:03 -08:00
parent 1961076664
commit 011cd4b44a
2 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,11 @@ namespace NewHorizons.Builder.Props
} }
} }
static DetailBuilder()
{
SceneManager.sceneUnloaded += SceneManager_sceneUnloaded;
}
#region obsolete #region obsolete
// Never change method signatures, people directly reference the NH dll and it can break backwards compatibility // Never change method signatures, people directly reference the NH dll and it can break backwards compatibility
// In particular, Outer Wives needs this method signature // In particular, Outer Wives needs this method signature
@ -49,8 +54,9 @@ namespace NewHorizons.Builder.Props
=> Make(go, sector, mod: null, detail); => Make(go, sector, mod: null, detail);
#endregion #endregion
public static void ClearCache() private static void SceneManager_sceneUnloaded(Scene scene)
{ {
// would be nice to only clear when system changes, but fixed prefabs rely on stuff in the scene
foreach (var prefab in _fixedPrefabCache.Values) foreach (var prefab in _fixedPrefabCache.Values)
{ {
UnityEngine.Object.Destroy(prefab.prefab); UnityEngine.Object.Destroy(prefab.prefab);

View File

@ -308,7 +308,6 @@ namespace NewHorizons
ImageUtilities.ClearCache(); ImageUtilities.ClearCache();
AudioUtilities.ClearCache(); AudioUtilities.ClearCache();
AssetBundleUtilities.ClearCache(); AssetBundleUtilities.ClearCache();
DetailBuilder.ClearCache();
} }
IsSystemReady = false; IsSystemReady = false;