Subscribing

Binds a given callback function to the specified topic(s). The callback will be executed upon any object sending event with matching topic.

There are three ways to subscribe:

  1. Subscribe to single topic with delegate

  2. Subscribe to all topics with delegate

  3. Subscribe to all topics as an interface implementer

Single object can subscribe multiple times to multiple topics using single or many callback functions. There is virtually no limitation other than your sanity.

The callback function must take in two parameters: Topic of type FGameplayTag and Payload of type UObject*, and have no return type (void).

Single topic with delegate

Achieved by calling SubscribeToTopic function and providing the callback function. The function returns a handle to the created binding.

All topics with delegate

Achieved by calling SubscribeToAllTopics function and providing the callback function. This allows to have a single handler for all topics. This is great for "catch 'em all" scenario or when need to filter/decide which events to respond to at runtime.

All topics as an interface implementer

Achieved by calling SubscribeToAllTopicsAsInterface function. The caller has to implement IDispatchitoSubscriberInterface which provides the OnEvent function acting as a callback.

Last updated