Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mrproex opened this issue Apr 29, 2024 · 2 comments
Open

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

Mrproex opened this issue Apr 29, 2024 · 2 comments

Comments

@Mrproex
Copy link

Mrproex commented Apr 29, 2024

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::il2cppArrayUnity::CGameObject** m_pObjects = Unity::Object::FindObjectsOfTypeUnity::CGameObject(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
Copy link
Collaborator

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

@extremeblackliu
Copy link
Collaborator

extremeblackliu commented Jun 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants