-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Access violation when trying to get field value #39
Comments
You could wrap the string in |
So I tried both, the u8 method throws the same error and getting all fields causes also a access violation writing location. Within the GetFields method return reinterpret_cast<Unity::il2cppFieldInfo * (IL2CPP_CALLING_CONVENTION)(void*, void**)>(Functions.m_ClassGetFields)(m_pClass, m_pIterator); std::vector<Unity::il2cppFieldInfo*> fields;
playerInstance->FetchFields(&fields);
for (Unity::il2cppFieldInfo* field : fields) {
std::cout << field->m_pName << std::endl; // Just so I can add a breakpoint
} Am I possibly accessing a class wrong? I am going to try and run it within a different application to see if it works there. |
Alright with a quick test on a different game I found the issue. It seems like Unity::CComponent* playerInstance = Unity::Object::FindObjectOfType<Unity::CComponent>("Player"); returns an incorrect pointer. If I look at the debug information the m_pName is not equal to "Player" but rather equal to "ðžê—z�". |
And when I change the type to |
It also seems like the flag "UNITY_VERSION_2022_3_8F1" is an incorrect version I currently have traced it back to Unity 2021.3.27f1 |
this flag is used for unity version that higher than 2022.3.8, your problem can be solve by using field offset from target class. |
The problem might be that you are searching for the player, but the player is probably a |
I know the difference however in using Il2CppDumper it specifically mentions Player in the root namespace. The class also returns correctly with the corresponding class so yes it's a component. |
I know its just accessing other classes causes the same error... |
see
game obfuscate doesn't affects system classes like gameobject, transform, camera ... etc, so when you get their classname, you should have non-obfuscate name or you messed up. |
also, own thread is not recommended, its very unstable and randomly crashes. |
May I ask, which game is this? |
Also tried this without any luck |
Phasmophobia |
I am trying to add a light component to the camera which is stored in the player class stored in an obfuscated value
And I am getting an error within
GetMemberValue
Unity version: 2022.3.5f1
Error: Access violation reading location 0xFFFFFFFFFFFFFFFF
The text was updated successfully, but these errors were encountered: