Could you record a video of your process? I don't work with dnSpy often and don't have access to the game you're working with. But I might be able to help after seeing how you're adding the new method.
So I'm completely new to this and I'm trying to hack a game called mini guns on steam. I opened up the Assembly-CSharp.dll in dnSpy and under a class called "CheatControl" there are literally hacks already made lol - there are methods that modify your manpower or give you gold (I assume these were made for debug purposes). But how do I use those methods? When I try to create an OnGUI() method it always makes it public extern void OnGUI(), which doesn't let me add anything to it. I can't find a way to get rid of the extern. Also sorry if this is a stupid question but where are the classes actually initialized (i.e. a new object is created)?
Could you record a video of your process? I don't work with dnSpy often and don't have access to the game you're working with. But I might be able to help after seeing how you're adding the new method.
Ah we-a blaze the fyah, make it bun dem!
Idk why but suddenly it lets me remove the extern and still compiles without errors... weird. Anyways now I have the problem of the actual button not showing up in game, so I guess I gotta figure out which classes to create the OnGUI method for so that it actually shows up in game. Also is there a way to call a method from another class in the method of a class (e.g. Class A has method A1, can Class B's method B1 call A1 in C#)?