I recently learned that Lyra's example of a UGameplayMessageSubsystem got an official/experimental version in the engine itself some time ago.
But searching for the term in this discord and others I haven't seen anyone mention it.
It has the same AddListener and Broadcast as original, but comes with a few new features.
- It supports cross thread messaging!
- You can bind to specific endpoints with options.
However the ergonomics of using the new replacementUAsyncMessageWorldSubsystemis slightly more low level and clunkier in C++.
It has a nice BP library (that is cpp private) so we can't use the UAsyncMessageSystemBlueprintLibrary sadly
But that's no problem when a simple C++ snippet can easily fix!
Original:
UAsyncMessageWorldSubsystem::GetSharedMessageSystem(GetWorld())->QueueMessageForBroadcast(FAsyncMessageId(MyGameplayTag), FConstStructView::Make(MyStruct))
WithHelper:
RockMessage::Broadcast(this, MyGameplayTag, MyStruct);`
And the listener
Original:
UAsyncMessageWorldSubsystem::GetSharedMessageSystem(Object->GetWorld())->BindListener(FAsyncMessageId(MyGameplayTag), TWeakObjectPtr(This), ThisClass::SomeFunc)
WithHelper:
RockMessage::RegisterListener(MyGameplayTag, this, &ThisClass::SomeFunc);
https://github.com/brokenrockstudios/GameDevCodex/blob/main/Unreal/Snippets/AsyncMessageWorldSubsystemSnippets.h
It's only a few lines easily copy/pasted into your projects!
Feel free to do whatever with. Enjoy!
If you have questions or issues. Let me know.