Store Delegates in a Container, Return Delegates in Functions

C++

In UE5.2, I'm trying to write publish/subscribe message subsystem. Ideally, I would have a TMap<FString, MyDynamicMulticastDelegateType> as a variable, with a function that maps FStrings to dynamic, multicast delegates.

To publish, I'd have a function:

void Publish(FString message)

that would look up the delegate corresponding to message and call Broadcast

​

There would be another function:

void Subscribe(FString message, MyDynamicMulticastDelegate& delegate)

that would look up the delegate corresponding to message, creating one if necessary, and return it as delegate. Then, you could bind to that delegate.

I expect the Publish and Subscribe functions to be called from blueprints.

Is such a thing possible? The compiler says my delegate "is not supported by blueprint"

​

Posted Oct 29, 2023, 10:13 PM UTC

14

No comments yet

Nobody commented on this post, or the comments weren't captured.