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

Game crash on m_pObject->GetName() call. #48

Open Mrproex opened 6 months ago

Mrproex commented 6 months ago

What is the game you are using with IL2CPP Resolver?

Waven

Details:

Game simply close after calling m_pObject->GetName() .

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

void Test() { Unity::il2cppArray<Unity::CGameObject> m_pObjects = Unity::Object::FindObjectsOfType(UNITY_GAMEOBJECT_CLASS);

printf("GameObjects found : %I64u", m_pObjects->m_uMaxLength);

for (uintptr_t u = 0U; m_pObjects->m_uMaxLength > u; ++u)
{
    Unity::CGameObject* m_pObject = m_pObjects->m_pValues[u];
    if (!m_pObject) continue; // Just in-case

    m_pObject->GetName();
}

}

void OnUpdate() {

}

void OnLoad() { AllocConsole(); ReOpenConsoleStreams();

IL2CPP::Initialize();

IL2CPP::Callback::Initialize();
IL2CPP::Callback::OnUpdate::Add(OnUpdate);

Test();

}

extremeblackliu commented 6 months ago

the loop should be Unity::CGameObject* m_pObject = m_pObjects->At(u);

extremeblackliu commented 5 months ago

However, I've been having the same problem in my recent code, but the triggering conditions are very random as far as I can tell, and it doesn't seem to raise the exception immediately when called, but rather after passing through several UnityEngine functions, and then crashing.

I might take the time to inspect what happened when i have free time.