womp womp

This commit is contained in:
JohnCorby 2025-01-29 17:17:03 -08:00
parent 1961076664
commit 0bb2c52947

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);