Help! How to call this method? (Instantiate)

AbyveX

Platinian
Dump.cs (Class: PhotonNetwork):
C#:
// RVA: 0x985160 Offset: 0x985160 VA: 0x985160
public static GameObject Instantiate(string prefabName, Vector3 position, Quaternion rotation, byte group = 0, object[] data) { }
Declaration (I have already prepared the structs for MonoString, Vector3, and Quaternion):
C++:
void* (*Instantiate)(monoString*, Vector3, Quaternion, unsigned char, void*) = (void*(*)(monoString*, Vector3, Quaternion, unsigned char, void*))getAbsoluteAddress("libil2cpp.so", 0x985160);
Another method:
C++:
void (*Instantiate)(monoString*, Vector3, Quaternion, unsigned char, void*) = (void*(*)(monoString*, Vector3, Quaternion, unsigned char, void*))getAbsoluteAddress("libil2cpp.so", 0x985160);
Call:
C++:
// Method 1:
Instantiate(CreateMonoString("P_Player"), Vector3(0.0f, 5.0f, 5.0f), Quaternion(0.0f, 0.0f, 0.0f, 1.0f), 0, nullptr);
// Method 2:
Instantiate(CreateMonoString("P_Player"), Vector3(0.0f, 5.0f, 5.0f), Quaternion(0.0f, 0.0f, 0.0f, 1.0f), 0, NULL);
After I called this method, the prefab was indeed generated, but the game crashed a few seconds later.
I also tried using il2cppTool to call this method, but it succeeded then. I guess the reason might be that I passed nullptr in the 'object[]', whereas in il2cppTool an empty 'data[0]' was created. I have no idea how to implement this 'data[0]' array in C++. Can someone help me? Thank you very much
1000093471.jpg
 
Back
Top Bottom