public void OnEnabled() { System.IO.File.WriteAllText("mod.debug.log", ""); // restart log. InstallHarmony(); LoadingWrapperPatch.OnPostLevelLoaded += PrefabUtils.CachePrefabs; #if DEBUG LoadingWrapperPatch.OnPostLevelLoaded += TestOnLoad.Test; #endif LoadingManager.instance.m_levelUnloaded += PrefabUtils.ClearALLCache; try { AppMode mode = Extensions.currentMode; if (mode == AppMode.Game || mode == AppMode.AssetEditor) { PrefabUtils.CachePrefabs(); } } catch { } }