LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.38k stars 472 forks source link

[Enhancement]: Attribute for RegisterTypeInIl2CppWithInterfaces #495

Closed MillzyDev closed 3 days ago

MillzyDev commented 1 year ago

Describe the new feature or enhancement

Similar to how the Unhollower RegisterTypeInIl2Cpp methods have an attribute for automatically registering, this feature would be an equivalent attribute but for the RegisterTypeInIl2CppWithInterfaces methods.

Example:

using System;
using System.ComponentModel;
using MelonLoader;
using UnityEngine;

[RegisterTypeInIl2CppWithInterfaces]
public class MyBehaviourWithInterfaces : MonoBehaviour, INotifyPropertyChanged
{
    public MyBehaviourWithInterfaces(IntPtr ptr) : base(ptr)
    {
    }
    ...
}

[RegisterTypeInIl2CppWithInterfaces(logSuccess: true)]
public class MyOtherBehaviourWithInterfaces : MonoBehaviour, INotifyPropertyChanged
{
    public MyOtherBehaviourWithInterfaces(IntPtr ptr) : base(ptr)
    {
    }
    ...
}
HerpDerpinstine commented 3 days ago

Should be implemented as of https://github.com/LavaGang/MelonLoader/commit/1a33c452322f9d8fcbdd2e3be7235acde6d76422