Subsystem that allows broadcasting and listening to global messages.
More...
#include "GlobalMessageSubsystem.h"
|
void | BroadcastMessage (const FGameplayTag FilterTag, UObject *Payload) |
|
void | ListenToMessage (const UObject *WorldContextObject, const FGameplayTag FilterTag, const FGlobalMessageReceiveDelegate &Callback) |
|
bool | RemoveListener (const UObject *ListenerObject) |
|
|
static UGlobalMessageSubsystem * | Get (const UWorld &TargetWorld) |
| Retrieves the instance of the global message subsystem for the specified world.
|
|
Subsystem that allows broadcasting and listening to global messages.
◆ BroadcastMessage()
void UGlobalMessageSubsystem::BroadcastMessage |
( |
const FGameplayTag | FilterTag, |
|
|
UObject * | Payload ) |
Broadcast a message to the global message subsystem. The message is sent to all listeners that are currently registered to receive messages with the specified filter tag. The payload object can be any UObject derived class providing the necessary data for the message.
- Parameters
-
FilterTag | The filter tag used to determine which listeners should receive the message. |
Payload | The payload object containing the data for the message. Can be nullptr if no data is needed. |
◆ Deinitialize()
void UGlobalMessageSubsystem::Deinitialize |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ Get()
Retrieves the instance of the global message subsystem for the specified world.
- Parameters
-
TargetWorld | The world for which to retrieve the global message subsystem. |
- Returns
- The instance of the global message subsystem for the specified world.
◆ ListenToMessage()
void UGlobalMessageSubsystem::ListenToMessage |
( |
const UObject * | WorldContextObject, |
|
|
const FGameplayTag | FilterTag, |
|
|
const FGlobalMessageReceiveDelegate & | Callback ) |
Listens for global messages that match the specified filter tag and invokes the provided callback function.
This function adds a listener to the global message subsystem, which allows you to receive global messages that match the specified filter tag. When a global message with a matching tag is received, the provided callback function is invoked.
- Parameters
-
WorldContextObject | The object that represents the world context. |
FilterTag | The tag used to filter the global messages. |
Callback | The delegate function to be invoked when a global message is received. |
◆ RemoveListener()
bool UGlobalMessageSubsystem::RemoveListener |
( |
const UObject * | ListenerObject | ) |
|
Removes a listener from the GlobalMessageSubsystem.
This method removes a listener object from the GlobalMessageSubsystem. Once removed, the listener will no longer be notified of any global message events.
- Parameters
-
ListenerObject | The listener object to be removed. |
- Returns
- True if the listener was successfully removed, false otherwise.
The documentation for this class was generated from the following files: