MethodInfo vs MethodBase #531
Closed
TonyValenti
started this conversation in
Ideas
Replies: 1 comment
-
That's not how how Harmony works. HarmonyMethod takes static methods that are then called from the body of the replacement method that replaces the original method. A constructor is just like any other method except that it has a void return type (unexpected) because at the IL level the instance is created before the constructor method is called (the uninitialised instance being passed in just like with instance methods) and the constructors job is to turn it from uninitialised to initialised. For that you can simply use Prefix/Postfix patches so no need for a MethodBase argument to HarmonyMethod. That wouldn't work practically anyway. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @pardeike -
It seems like HarmonyMethod takes a MethodInfo when it really should likely take a MethodBase.
I'd like to extend ("override") a constructor to change some defaults and it doesnt seem like HarmonyMethod will let me do that.
Can you make that change?
Beta Was this translation helpful? Give feedback.
All reactions