I’ve just started to learn Unreal Engine.
I have created HUD using UMG and now I want to access a function that I have defined on it using C++. The code to get the function is:
UFUnction* Func = Obj->GetClass()->FindFunction(FName("FuncName"));
if(Func == nullptr){return;}
FStructOnScope FuncParam(Func);
UProperty* ReturnProp = nullptr;
for (TFieldIterator<UProperty> It(Func); It; ++It)
{
UProperty* Prop = *It;
if (Prop->HasAnyPropertyFlags(CPF_ReturnParm))
{
ReturnProp = Prop;
}
else
{
//FillParam here
}
}
Obj->ProcessEvent(Func, FuncParam.GetStructMemory());
But… I don’t know how to //Fillparam here
.
How can I fill the FuncParam
with the parameters that I need to pass?