Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition
by John P. Doran, William Sherif, Stephen Whittle
How it works...
When we bind the function to the delegate, we specify some additional data (in this case, a Boolean of value false). You can pass up to four "payload" variables in this fashion. They are applied to your function after any parameters are declared in the DECLARE_DELEGATE_* macro that you used.
We change the function signature of our delegate so that it can accept the extra argument.
Inside the function, we use the extra argument to turn the light on or off, depending on the value being true or false at compile time.
We don't need to change the call to ExecuteIfBound: the delegate system automatically applies the delegate parameters, which are passed in through ExecuteIfBound first. It then applies any payload parameters, which ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access