sneakyevil / IL2CPP_Resolver

A run-time API resolver for IL2CPP Unity.
https://sneakyevil.gitbook.io/il2cpp-resolver/
The Unlicense
362 stars 67 forks source link

Added FindChild and GetComponentInChildren #29

Closed ImAxel0 closed 1 year ago

ImAxel0 commented 1 year ago

Added these two because I needed one of them to continue developing a game trainer

I'm not sure I implemented them the best way but they both work.

sneakyevil commented 1 year ago

Seems fine in most cases, but you should add another function which doesn't require IL2CPP::Class::Find, since calling IL2CPP::Class::Find can have big performance hit. You can check the GetComponents function how it is defined with 2 options. Also checking if const char* is valid shouldn't be even there its up to user end to check properly before they call the API. Anyway after that I will pull the request.

ImAxel0 commented 1 year ago

I understand that there is no need to check if the const char* in the FindChild function is NULL, but I don't understand how I should implement GetComponentInChildren without using IL2CPP::Class::Find since I see the same structure in the function below (GetComponents) and other functions.

sneakyevil commented 1 year ago

Oh, yeah I noticed you already defined it I just overlooked it my bad.