Download

Array of delegates

Hey guys,

Is it possible to have an array of delegates
I tried to do that like this but it didn’t work


UPROPERTY(BlueprintAssignable, BlueprintReadWrite)
TArray<FSomeMultiCastDelegate> OnSomething;

it did compile but it didn’t show up in the blueprint editor
I even tried to put a delegate in a struct but that didn’t work

Am I doing some thing wrong or there cannot be a delegate in a struct or arrays ??

thanks alot

I would be also interested in this.
Could you find a solution?

Also interested.

Had the same problem recently, implemented this workaround, maybe it will work for you.


USTRUCT()
struct YOURGAME_API FDelegateWrapper
{
GENERATED_BODY()

FDelegateWrapper(){}

FDelegateWrapper(FDelegateHandle InDelegateHandle)
: DelegateHandle(InDelegateHandle)
{

}

FDelegateHandle DelegateHandle;
};

Usage like this:


FSomeDelegate SomeDelegate;

TMap<int32, FDelegateWrapper> MyMap;

MyMap.Add(10, FDelegateWrapper(SomeDelegate.GetHandle()));

MyMap[10].DelegateHandle.Reset();