I know the following commend will run a blueprint function by a given name :
CallFunctionByNameWithArguments(“function name”, outputDeviceNull, NULL, true)
I want to know if there is a way to get the return value of such function if it has any.
I found a work around.
I use a BlueprintImplementable function and cast it to a predefine interface.
this way i can simply be sure that a specific function exist in a class, because the class is drived from the interface I have already have access to.
Here is a sample code
Interface :
class IMyinterface
{
public:
virtual bool SampleFunction() = 0;
};
Blueprint class
UCLASS(Blueprintable)
class TEST_THREAD_API ASample_Actor : public AActor, public IMyinterface
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, Category = "some category")
bool SampleFunction();
};
Now you can always cast a pointer of “ASample_Actor*” to “IMyinterface*” and access the interface functions ( in this case it’s SampleFunction )