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
UserR00T edited this page Aug 9, 2021
·
1 revision
AddMethodModule
This module is used to add a specific method to the target type. By decorating your method with the AddMethodAttribute you will allow UniversalUnityHooks to add your method. Very useful for reflection grabbed methods, like Unity's Enable, Update, and more.
Example
// Source (plugin)[AddMethodAttribute(typeof(ExampleType))]publicstaticvoidEnable(ExampleTypeexampleType){Debug.Log($"Target type got enabled! {exampleType.name}");// Console.log for non Unity applications.}// Target _after_ injecting (Assembly-CSharp.dll)publicclassExampleType{// This method has just been added by UniversalUnityHooks. References and using declarations will be automatically handled.publicvoidEnable(){MyPluginType.Enable(this);}}