How it works...

As you might expect, the delegate type needs to be explicitly declared as a multicast delegate rather than a standard single-binding one. Our new Listener class is very similar to our original DelegateListener. The primary difference is that we need to store a reference to our delegate instance in FDelegateHandle.

When the actor is destroyed, we safely remove ourselves from the list of functions that are bound to the delegate by using the stored FDelegateHandle as a parameter to Remove().

The Broadcast() function is the multicast equivalent of ExecuteIfBound(). Unlike standard delegates, there is no need to check whether the delegate bound either in advance or with a call such as ExecuteIfBound. Broadcast() is safe to run, no matter how many functions are bound, or even if none are.

When we have multiple instances of our multicast listener in the scene, they each register themselves with the multicast delegate that's implemented in the GameModeThen, when the TriggerVolume overlaps a player, it broadcasts the delegate, and each Listener is notified, causing it to toggle the visibility of its associated point light.

Multicast delegates can take parameters in exactly the same way that a standard delegate can.