new-horizons/NewHorizons/Patches/StreamingPatches.cs
2022-12-28 12:11:56 -08:00

27 lines
867 B
C#

using HarmonyLib;
using NewHorizons.Handlers;
using OWML.Logging;
namespace NewHorizons.Patches
{
[HarmonyPatch]
public static class StreamingPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(StreamingManager), nameof(StreamingManager.UnloadStreamingAssets))]
public static bool StreamingManager_UnloadStreamingAssets(string assetBundleName)
{
// Only let it unload stuff that isn't being used
return !StreamingHandler.IsBundleInUse(assetBundleName);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UnityLogger), "OnLogMessageReceived")]
public static bool UnityLogger_OnLogMessageReceived(string message)
{
// Filter out goofy error that doesn't actually break anything
return !message.EndsWith(" is out of bounds (size=0)");
}
}
}