Skip to content

Commit 1e385d4

Browse files
committed
feat: use UDA Patch Collector instead of old Harmony Marshal
1 parent 450abb0 commit 1e385d4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/UnityDebuggerAssistant/Plugin.cs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using BepInEx;
1+
using BepInEx;
22
using BepInEx.Logging;
33
using HarmonyLib;
44
using MonoMod.RuntimeDetour;
5+
using UnityDebuggerAssistant.Components;
56
using UnityDebuggerAssistant.Patches;
67
using UnityDebuggerAssistant.Utils;
78
using UnityEngine;
@@ -19,6 +20,7 @@ you in your first CSharp plugin!
1920
public class Plugin : BaseUnityPlugin
2021
{
2122
public static ManualLogSource Log = null!;
23+
internal static Plugin Instance = null!;
2224

2325
private void Awake()
2426
{
@@ -38,13 +40,17 @@ We assign it here
3840
ILHook.OnDetour += MonoModPatchListener.ListenForPatch;
3941

4042
Harmony harmony = new(LCMPluginInfo.PLUGIN_GUID);
41-
harmony.PatchAll(typeof(StartOfRoundPatches));
4243
harmony.PatchAll(typeof(ExceptionPatches));
4344

44-
PatchStorage.AddPatchInformation(typeof(HarmonyPatchMarshal).GetMethod("RunMarshal"), this.GetType().Assembly);
45+
Log.LogInfo("Deferring plugin collection..");
4546

46-
//Uncomment this to get a demo exception to test with
47-
//ExceptionHandler.DebugThrow();
47+
var go = new GameObject("UDA Patch Collector", [
48+
typeof(UDAPatchCollector)
49+
])
50+
{
51+
hideFlags = HideFlags.HideAndDontSave
52+
};
53+
DontDestroyOnLoad(go);
4854

4955
}
5056

0 commit comments

Comments
 (0)