mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +08:00
Cleanup
This commit is contained in:
parent
28b6db80f9
commit
9fe998aa22
@ -497,23 +497,18 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
// AssetBundle patch
|
// AssetBundle patch
|
||||||
|
|
||||||
static bool donePatch;
|
private static Type TypeofAssetBundle => ReflectionUtility.GetTypeByName("UnityEngine.AssetBundle");
|
||||||
private static Type T_AssetBundle => ReflectionUtility.GetTypeByName("UnityEngine.AssetBundle");
|
|
||||||
|
|
||||||
private static void SetupAssetBundlePatches()
|
private static void SetupAssetBundlePatches()
|
||||||
{
|
|
||||||
if (!donePatch)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (T_AssetBundle.GetMethod("UnloadAllAssetBundles", AccessTools.all) is MethodInfo unloadAllBundles)
|
if (TypeofAssetBundle.GetMethod("UnloadAllAssetBundles", AccessTools.all) is MethodInfo unloadAllBundles)
|
||||||
{
|
{
|
||||||
var processor = ExplorerCore.Harmony.CreateProcessor(unloadAllBundles);
|
var processor = ExplorerCore.Harmony.CreateProcessor(unloadAllBundles);
|
||||||
var prefix = new HarmonyMethod(typeof(UIManager).GetMethod(nameof(Prefix_UnloadAllAssetBundles), AccessTools.all));
|
var prefix = new HarmonyMethod(typeof(UIManager).GetMethod(nameof(Prefix_UnloadAllAssetBundles), AccessTools.all));
|
||||||
processor.AddPrefix(prefix);
|
processor.AddPrefix(prefix);
|
||||||
processor.Patch();
|
processor.Patch();
|
||||||
|
|
||||||
donePatch = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -521,7 +516,6 @@ namespace UnityExplorer.UI
|
|||||||
ExplorerCore.LogWarning($"Exception setting up AssetBundle.UnloadAllAssetBundles patch: {ex}");
|
ExplorerCore.LogWarning($"Exception setting up AssetBundle.UnloadAllAssetBundles patch: {ex}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool Prefix_UnloadAllAssetBundles(bool unloadAllObjects)
|
static bool Prefix_UnloadAllAssetBundles(bool unloadAllObjects)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user