You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add a listener to a delegate, but I get an exception when the event runs.
BepInEx 6.0.0-be.665
Game is Unity 2022.1, v29 metadata (BepInEx says Running under Unity 2021.2.0f1 though?)
Setup:
// GameEvent is `public delegate void GameEvent();` (class that extends `Il2CppSystem.MulticastDelegate`)// Plugin.OnRoundBegin is `public static void OnRoundBegin() {}`
GameEvents.OnRoundBegin +=(GameEvents.GameEvent)Plugin.OnRoundBegin;// or
GameEvents.OnRoundBegin +=(System.Action)Plugin.OnRoundBegin;
Error when the event happens:
[Error :Il2CppInterop] Exception in IL2CPP-to-Managed trampoline, not passing it to il2cpp: System.InvalidOperationException: Handle is not initialized.
at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
at Il2CppInterop.Runtime.Runtime.ClassInjectorBase.GetMonoObjectFromIl2CppPointer(IntPtr pointer) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Runtime/ClassInjectorBase.cs:line 15
at (il2cpp delegate trampoline) System.Void_System.Action(IntPtr , Il2CppMethodInfo* )
I could just be doing something wrong, but I've tried a bunch of variations and couldn't get it to work.
(I wasn't 100% sure if I should open here or in BepInEx/BepInEx so feel free to transfer)
The text was updated successfully, but these errors were encountered:
I'm trying to add a listener to a delegate, but I get an exception when the event runs.
BepInEx 6.0.0-be.665
Game is Unity 2022.1, v29 metadata (BepInEx says
Running under Unity 2021.2.0f1
though?)Setup:
Error when the event happens:
I could just be doing something wrong, but I've tried a bunch of variations and couldn't get it to work.
(I wasn't 100% sure if I should open here or in BepInEx/BepInEx so feel free to transfer)
The text was updated successfully, but these errors were encountered: