Using Global Messenger
UGlobalMessageSubsystem decouples senders and receivers across your entire level. Terminal commands, programs, and world actors can broadcast and listen without direct references — the pattern used in the demo game to open a roof door from the in-world Terminal.
Full API details: Global Messenger Subsystem.
sequenceDiagram participant Cmd as UOperatingSystemTerminalCommand participant GM as UGlobalMessageSubsystem participant Door as BP_Door level actor Cmd->>GM: BroadcastMessage(gameplay tag, payload) GM->>Door: ListenToMessage callback Door->>Door: Toggle open/closed
Tutorial — switch opens a door
Section titled “Tutorial — switch opens a door”1. Define a gameplay tag
Section titled “1. Define a gameplay tag”Create a tag such as Message.OS.Door.Toggle under Project Settings → Gameplay Tags.
2. Broadcast from Terminal command
Section titled “2. Broadcast from Terminal command”In your custom terminal command Blueprint:
Event Process Command → Get Global Message Subsystem → Broadcast Message (Filter Tag: Message.OS.Door.Toggle, Payload: optional door actor) → Continue Execution3. Listen on the door actor
Section titled “3. Listen on the door actor”On BP_Door Event BeginPlay:
Get Global Message Subsystem → Listen to Message (Filter Tag: Message.OS.Door.Toggle) Callback → Toggle Door Open/Closed → Remove Listener (self) after first use if one-shot4. Test
Section titled “4. Test”Play in editor, boot the OS, open Terminal, run your command. The door should react with no wire between Terminal Blueprint and door actor.
C++ broadcast
Section titled “C++ broadcast”#include "GlobalMessageSubsystem.h"
void UCMD_ToggleDoor::OnProcessCommand(){ if (const UGlobalMessageSubsystem* MS = UGlobalMessageSubsystem::Get(*GetWorld())) { MS->BroadcastMessage(FGameplayTag::RequestGameplayTag("Message.OS.Door.Toggle"), nullptr); } ContinueExecution();}Build.cs:
PrivateDependencyModuleNames.AddRange(new string[] { "GlobalMessenger", "GameplayTags" });C++ listen
Section titled “C++ listen”UFUNCTION()void ADoor::OnDoorMessage(UObject* Payload);
void ADoor::BeginPlay(){ Super::BeginPlay(); if (UGlobalMessageSubsystem* MS = UGlobalMessageSubsystem::Get(*GetWorld())) { FGlobalMessageReceiveDelegate Delegate; Delegate.BindDynamic(this, &ADoor::OnDoorMessage); MS->ListenToMessage(this, DoorTag, Delegate); }}Viewport World integration
Section titled “Viewport World integration”Global Messenger is how Viewport World spawns gameplay in a secondary world when a terminal command runs — see the preview video on the Global Messenger page.
Related
Section titled “Related”- Custom terminal command
- Using Device Messenger — events scoped to one device