How to create custom event with array of structs as output node in Blueprint from C++

I defined the following delegate in C++

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHostsReceivedDelegate, TArray<FHost>, Hosts);

And exposed it as a property

 UPROPERTY(BlueprintAssignable)
 FHostsReceivedDelegate HostsReceivedHandler;

In my BP I try to create a custom event to bind to it, but will get an error. With a different delegate it worked using FString and int32 as output types.

Is this even possible and if so, what needs to be changed?

The declaration needs to be:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FReceivedHostsDelegate, TArray<FHost>, Hosts);

Nope. “Server.h(30): error : Missing ‘<’ in ‘tarray’” if i try: DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FUserServerDataDelegate, const TArray&, action);

EDIT
OK, i have it.

h

//Delegates
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FUserServerDataDelegate, const TArray<FString>&, data);


UFUNCTION()
	void UserServerDataDelegate(const TArray<FString>& data);
UPROPERTY(BlueprintAssignable, Category = "0_UserData")
	FUserServerDataDelegate onUserServerDataDelegate;

cpp

UServer::UServer()
{
	//Delegate
	onUserServerDataDelegate.AddDynamic(this, &UServer::UserServerDataDelegate);
}

/*Delegate functions*/
void UServer::UserServerDataDelegate(const TArray<FString>& data) {}

You are right. I have edited the code. Even though it is the same as I gave in my question, I think in the end it was how I was binding the event in BP was wrong.

Nice, good work!

Sorry for updating the old topic but I met the same problem today. Does anybody know why it is required to pass TArray of structs by reference?

I’m also new to this so arrived here while looking for answers. Just in case anyone else stumbles across this page in future, allow me to try and be of assistance:

From what I understand, variables passed by reference are treated as output nodes and those that are not passed by reference are treated as input nodes. Simple as that.