Skip to content

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

Create a tag such as Message.OS.Door.Toggle under Project Settings → Gameplay Tags.

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 Execution

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-shot

Play in editor, boot the OS, open Terminal, run your command. The door should react with no wire between Terminal Blueprint and door actor.

#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" });
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);
}
}

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.