UE5 Delegate Parameters vs Payload Data

Advertisement

You may be wondering what’s the difference between UE5 Delegate Parameters and Payload Data as described in the Delegate documentation.

Jump to the “Payload Data Example Use Case” section for an explanation by example if you prefer examples.

The Callback Function Signature

The main difference between Payload Data and Parameters has to do with the binding function’s signature.

The binding function/callback signature has to match our delegate parameters PLUS desired extra parameters(payload data).

 

Delegate Parameters

  • Required in EVERY callback function that wishes to bind to our delegate.
  • Defined when delegate is created with DECLARE_DELEGATE or any similar macro.
  • If you want every Bound function to receive data/argument as part of it’s signature, you include it as a delegate Parameter.

Delegate Payload Data

  • Required ONLY IN callback functions that wish to receive extra parameters, in addition to the required parameters above,  from our delegate when it broadcasts/executes.
  • Defined when delegate is bound (bind is called) to our function.

Payload Data Example Use Case

You already have a function that takes in 8 parameters and it’s being used in other parts of your code.

The first two arguments of the function match our new delegate function parameters. So:

We already have a function that takes in 8 arguments and we want to bind it to a delegate that passes only 2 parameters. 

The solution is to pass the rest of the 6 arguments required by the function as Payload data at BIND time.

5/5

Gamechanger plugin for notehighway rhythm games and music visualizers

5/5

Add Text and 2D UMG widgets to Level Sequences

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!