If you have a UFunction pointer, the following code allows calling it:

struct
{
	double X = 100;
	double Y = 10;
 
	bool ReturnValue;
} Params;
 
UFunction* Func = /* Get a UFunction from somewhere */;
OwnerObject->ProcessEvent(Func, &Params);
 
if(Params.ReturnValue)
{
	//function returned `true`
}

First, define a struct to hold the parameters and return value. The types must match the function signature, or you might crash. If the function returns something, it must be the last member of the struct. The names of the properties of the struct don’t matter.

If the function has no parameters or a return value, pass in nullptr.

OwnerObject should be the UObject the function belongs to.

(Thanks to Eren on Unreal Source Discord for original example)