BlueprintCallable function with delegate doesn't work if the delegate has a TArray of UObjects

I’m writing a Blueprint callable wrapper for the AssetManager, and I ran into an issue with my delegate/event setup. I accept a singlecast delegate from blueprint callable function, bind it to a multicast delegate, and broadcast it when the operation finishes. I’ve done this with a few different objects.

However for some reason it doesn’t want to play nice with my TArray<UObject*> parameter.

Here’s my declaration:

DECLARE_DYNAMIC_DELEGATE_OneParam(FDataAssetProviderOnAsyncLoadAssetBP, TArray<UObject*>, DataAssetType);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDataAssetProviderOnAsyncLoadAsset, TArray<UObject*>, DataAssetType);

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class DEVILDJ_API UDJDataAssetProvider : public UActorComponent
{
	GENERATED_BODY()
public:	
	UFUNCTION(BlueprintCallable)
	void AsyncLoadAssets(FDataAssetProviderOnAsyncLoadAssetBP Delegate);
//...

However in the editor blueprint, I can’t hook up an Event to the actual function call. I get an editor compilation error:

This is even when I drag out from the pin directly. I’ve recompiled everything to double check it wasn’t some cached signature. So the error message is wrong here.

I can work around this by removing the parameter and having the array accessible directly on the object, but is there a reason why this particular implementation doesn’t work?

Reflection and blueprints can sometimes be a little persnickety about what type is expected. Have you tried changing the array parameter to a const-reference?

DECLARE_DYNAMIC_DELEGATE_OneParam(FDataAssetProviderOnAsyncLoadAssetBP, const TArray<UObject*>&, DataAssetType);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDataAssetProviderOnAsyncLoadAsset, const TArray<UObject*>&, DataAssetType);
1 Like