Skip to content

Commit

Permalink
Fixed an issue with Il2Cpp Class Injection Attributes causing excepti…
Browse files Browse the repository at this point in the history
…ons to be thrown on Mono games
  • Loading branch information
HerpDerpinstine committed Sep 30, 2024
1 parent 1a33c45 commit 3512c92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class RegisterTypeInIl2CppWithInterfaces : Attribute //Naming violation?
internal static List<Assembly> registrationQueue = new List<Assembly>();
internal static bool ready;
internal bool LogSuccess = true;

internal Type[] Interfaces;
internal bool GetInterfacesFromType;

Expand Down
3 changes: 3 additions & 0 deletions MelonLoader/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ internal static int Start()
return 1;

AddUnityDebugLog();

#if NET6_0_OR_GREATER
RegisterTypeInIl2Cpp.SetReady();
RegisterTypeInIl2CppWithInterfaces.SetReady();
#endif

MelonEvents.MelonHarmonyInit.Invoke();
MelonEvents.OnApplicationStart.Invoke();
Expand Down
2 changes: 2 additions & 0 deletions MelonLoader/Melons/MelonAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ public void LoadMelons()
}
}

#if NET6_0_OR_GREATER
RegisterTypeInIl2Cpp.RegisterAssembly(Assembly);
RegisterTypeInIl2CppWithInterfaces.RegisterAssembly(Assembly);
#endif

if (rottenMelons.Count != 0)
{
Expand Down

0 comments on commit 3512c92

Please sign in to comment.