sneakyevil / IL2CPP_Resolver

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

Crash On FindObjectsOfType #46

Closed hellotheresanta closed 5 months ago

hellotheresanta commented 6 months ago

Hello, i've been toying with this il2cpp_resolver and gotten some basic stuff to work. but after a minute or 2 my game kept crashing. upon repeatedly inspecting what might've happened. it appears this is the last line of code that is attempted to execute before the program crashes. not always but guaranteed once every 5 minutes or so requiring me to restart my game.

image

any insights on what might cause it or what i could do ?

vvocach commented 5 months ago

yeah, i'm facing the same issue !

extremeblackliu commented 5 months ago

sorry i dont watch this repository often, you said every 5 minutes the game crash on it? can you provide the code or poc, i tested this before i push to the repository.

extremeblackliu commented 5 months ago

@vvocach ^

Mevasss commented 5 months ago

this problem is probably caused by the fact that when creating an object, unity also searches for it, but because it is not fully created, a crash occurs. For me, this problem is completely solved by searching for objects inside OnUpdatecallback.

`static inline int stat; static auto OnLateUpdate_callback() -> void { ++stat;

if (stat >= 60) {

    auto p = Unity::Object::FindObjectsOfType<void*>("Player_move_c", false);

    std::cout << p->m_uMaxLength << std::endl;

    stat = 0;
}

}`

extremeblackliu commented 5 months ago

closed for inactive and no future response.