This is the AMP version of this page.
If you want to load the real page instead, click this text.

Help! Help with AddComponent

0xByte

Rookie
I use AddComponent from the GameObject class, but for some reason it crashes, I also use get_gameObject from the GameObject class

void* (*getGameObject)(void*);
void (*setPosition)(void*, Vector3);
void (*setText)(void*, monoString*);
void* (*addComponent)(void*,void*);
void* (*getType)(monoString*);
void* (*getTransform)(void*);
void (*setScale)(void*, Vector3);
void (*_GetTextTest2)(void*);
void GetTextTest2(void* update)
{
if(update!=NULL)
{

void* _image = *(void**) ((uint64_t) update + 0x18);
void* textComponent = addComponent(getGameObject(_image) , CreateString("UnityEngine.UI.Text,UnityEngine.UI"));

setText(textComponent, CreateString("StartGame"));
setPosition(getTransform(textComponent), Vector3(0,0,0));

}
_GetTextTest2(update);
}

MSHookFunction((void *) getAbsoluteAddress(libName, 0xA65608), (void *) GetTextTest2, (void **) & _GetTextTest2);

GameObject::get_transform
getTransform = (void* (*)(void*))getAbsoluteAddress(libName, 0x1F98328);
GameObject::Get_gameObject
getGameObject = (void* (*)(void*))getAbsoluteAddress(libName, 0x1F98374);
Type::getType(string)
getType = (void* (*)(monoString*))getAbsoluteAddress(libName, 0x18EFBA4);
GameObject::AddComponent
addComponent = (void* (*)(void*, void*))getAbsoluteAddress(libName, 0x1F9CAB0);
Text::SetText
setText = (void (*)(void*, monoString*))getAbsoluteAddress(libName, 0x221BAD8);
Transform::set_localPosition
setPosition = (void (*)(void*, Vector3))getAbsoluteAddress(libName, 0x1FA83C4);