Hello. I just wanted to ask if anybody knows if or how you can call a UObject’s UFUNCTION, one that has a return value, via its name? I tried “CallFunction(FFrame& Stack, RESULT_DECL, UFunction* Function)” and “ProcessEvent( UFunction* Function, void* Parms )” which work fine, even with parameters, but as soon as I add a return value to my function they crash. Any ideas?
ProcessEvent is what you want. Try something like this:
struct Params
{
// Ordered parameters here
[Arg1Type] Arg1;
[Arg2Type] Arg2;
...
// Return value last
[ReturnType] RetVal;
};
Params Parameters;
// <Assign argument values here>
Object->ProcessEvent(Function, &Parameters);
// <Do something with return value here>
I don’t know if there are any rules regarding padding/byte alignment, but so far this has worked for me.
2 Likes
Thank you @kamrann, works perfectly. I just wish there was some documentation for this kind of stuff.