Skip to main content

Dynamic multicast delegate

A multicast event with parameters that anyone can bind to (in C++ or Blueprint). Perfect for "this happened, everyone interested knows".

Declare + member + broadcast​

uclass ADoor : AActor meta: api=MYGAME_API
{
declare DynamicMulticast FOnDoorOpened (OneParam APawn*, Opener)

field public FOnDoorOpened OnDoorOpened

func public void Open(APawn* Opener) BlueprintCallable
{
OnDoorOpened.Broadcast(Opener);
}
}
  • declare DynamicMulticast FOnDoorOpened (OneParam APawn*, Opener) - declares the delegate type with one APawn* parameter named Opener.
  • field public FOnDoorOpened OnDoorOpened - the broadcastable member, exposed to Blueprints (BlueprintAssignable).
  • OnDoorOpened.Broadcast(Opener); - fires it with the data.

Parameter arities​

TPScriptDECLARE macro
(NoParams)DECLARE_DYNAMIC_MULTICAST_DELEGATE
(OneParam T, Name)..._OneParam
(TwoParams T1, N1, T2, N2)..._TwoParams
(ThreeParams ...)..._ThreeParams

Binding​

  • Blueprint: on the actor, Assign the delegate with an event.
  • C++: OnDoorOpened.AddDynamic(this, &ADoor::OnSomeHandler);

Handlers matching the signature are bound automatically. For non-dynamic (native) singletons you might prefer DECLARE_DYNAMIC_DELEGATE - but multicast is the usual choice for events.