ByNameModding / BNM-Android

Modding il2cpp games by classes, methods, fields names on Android.
MIT License
203 stars 39 forks source link

How to call game functions? #64

Closed 2079541547 closed 3 weeks ago

2079541547 commented 1 month ago

I need to call a function in the game to perform an operation, which requires passing in an int value, but I am not sure how to obtain and call this function

nik2143 commented 3 weeks ago

This should answer your question If isn't what you want provide more infos The answer implies that the method you want call is in the same class of the method you are hooking so _this is the instance of the class, if isn't in the same class you should find a way to get an instance of it

Method<void> MethodName = Class("NameSpace",ClassName).GetMethod("methodname");
MethodName[_this](valueToPass);