This answer just changed my life, thank you. Don’t know why I never thought of this before!
This is the correct answer.
Magic answer!
brilliant!
You can’t do an array…
It is useless in BP realm, though, you can’t call it in a generic way. For example, SetTimer produces delegate with no params and BeginPlay or CustomEvent have no params but you can’t pass it around and then call directly, as a delegate, to execute logic.
Do you know what delegate type I’d need to use if I wanted to pass the parameter from a blueprint function to a C++ blueprint function library method?
It appears as if under the hood UE uses TMulticastScriptDelegate/FMulticastScriptDelegate to represent a delegate added by dragging the node backwards. But I’m not able to compile when trying the below in a BPFL as UBT isn’t able to reconcile the delegate class type.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ScriptDelegates.h"
#include "bpDelegateBPFL .generated.h"
UCLASS()
class VR_BASE_API UbpDelegateBPFL : public UBlueprintFunctionLibrary {
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Utilities|Delegate", meta = (DisplayName = "Foo (Delegate)", BlueprintThreadSafe))
static bool Foo(FMulticastScriptDelegate* bpDelegate);
UFUNCTION(BlueprintCallable, Category = "Utilities|Delegate", meta = (DisplayName = "Bar (Delegate)", BlueprintThreadSafe))
static bool Bar(TMulticastScriptDelegate* bpDelegate);
}