This repository was archived by the owner on May 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -497,30 +497,24 @@ private static byte[] ReadFully(Stream input)
497
497
498
498
// AssetBundle patch
499
499
500
- static bool donePatch ;
501
- private static Type T_AssetBundle => ReflectionUtility . GetTypeByName ( "UnityEngine.AssetBundle" ) ;
500
+ private static Type TypeofAssetBundle => ReflectionUtility . GetTypeByName ( "UnityEngine.AssetBundle" ) ;
502
501
503
502
private static void SetupAssetBundlePatches ( )
504
503
{
505
- if ( ! donePatch )
504
+ try
506
505
{
507
- try
508
- {
509
- if ( T_AssetBundle . GetMethod ( "UnloadAllAssetBundles" , AccessTools . all ) is MethodInfo unloadAllBundles )
510
- {
511
- var processor = ExplorerCore . Harmony . CreateProcessor ( unloadAllBundles ) ;
512
- var prefix = new HarmonyMethod ( typeof ( UIManager ) . GetMethod ( nameof ( Prefix_UnloadAllAssetBundles ) , AccessTools . all ) ) ;
513
- processor . AddPrefix ( prefix ) ;
514
- processor . Patch ( ) ;
515
-
516
- donePatch = true ;
517
- }
518
- }
519
- catch ( Exception ex )
506
+ if ( TypeofAssetBundle . GetMethod ( "UnloadAllAssetBundles" , AccessTools . all ) is MethodInfo unloadAllBundles )
520
507
{
521
- ExplorerCore . LogWarning ( $ "Exception setting up AssetBundle.UnloadAllAssetBundles patch: { ex } ") ;
508
+ var processor = ExplorerCore . Harmony . CreateProcessor ( unloadAllBundles ) ;
509
+ var prefix = new HarmonyMethod ( typeof ( UIManager ) . GetMethod ( nameof ( Prefix_UnloadAllAssetBundles ) , AccessTools . all ) ) ;
510
+ processor . AddPrefix ( prefix ) ;
511
+ processor . Patch ( ) ;
522
512
}
523
513
}
514
+ catch ( Exception ex )
515
+ {
516
+ ExplorerCore . LogWarning ( $ "Exception setting up AssetBundle.UnloadAllAssetBundles patch: { ex } ") ;
517
+ }
524
518
}
525
519
526
520
You can’t perform that action at this time.
0 commit comments