Closed SamuelBucher closed 1 year ago
You use object
as type and then different ways to access fields on in like FieldRef or simple reflections.
Please note that Issues are for bugs or new features in Harmony. Use the discord for support questions like this one.
I'm using Harmony for my RimWorld mod, and I want to patch a method called
DrawExtraEyeGraphic()
withinPawnRenderer
. Unfortunately, that method is actually a local method ofDrawHeadHair()
, which makes things a lot more complicated. According to dNSpy, after compilation, this translates intoDrawExtraEyeGraphic()
being contained within a weirdly named class<>c__DisplayClass54_0
withinPawnRenderer
. I know how to access and patchDrawExtraEyeGraphic()
:With this code, I successfully prevented the
DrawExtraEyeGraphic()
method from running. However, I actually want to replace it with a slightly modified version of itself. To do this, I need access to the fields of the compiler generated class I'm patching through__instance
. Despite my searching, I couldn't find any info on how to do that. I can't just put the class's name into my code since it doesn't abide syntax. Any help?