CrimsonCommon · Lesson 5 of 7
Broadcast & Listen for Messages
Before you start
- Completed: Enable the Plugin
- A gameplay tag to use as a message channel (e.g. Message.Score.Changed)
Chapters
Why a message bus
UCrimsonMessageSubsystem is a tag-routed message bus: a sender broadcasts a payload struct on a channel tag, and anything can listen on that tag — no delegate wiring, no hard references between the two. It's how Crimson plugins notify each other without depending on each other.
Broadcast and listen
Broadcast with the Broadcast Message node from the subsystem, passing your channel tag and payload struct. Listen with the async Listen for Crimson Messages node — it stays active and fires its output pin every time a matching message arrives:
In C++, get the subsystem and broadcast a struct on a channel tag; register listeners with a member function — that overload is weak-object-safe, so a destroyed listener just stops receiving:
// BroadcastFMyScoreMessage Msg;Msg.Points = 50;UCrimsonMessageSubsystem::Get(this)->BroadcastMessage(TAG_Message_Score_Changed, Msg);// Listen (member-function overload is weak-object-safe)UCrimsonMessageSubsystem::Get(this)->RegisterListener(TAG_Message_Score_Changed, this, &UMyScoreWidget::OnScoreMessage);
Match modes
Listeners choose ECrimsonMessageMatch: ExactMatch receives only the exact channel tag, while PartialMatch also receives child tags — listen on Message.Score partially and Message.Score.Changed reaches you too.