With only minimal changes, parameters can be passed through to a delegate at creation time. This recipe shows you how to specify data to be always passed as parameters to a delegate invocation. The data is calculated when the binding is created, and doesn't change from that point forward.
Be sure you've followed the previous recipe. We will be extending the functionality of the previous recipe to pass additional creation-time parameters to our bound delegate function.
Inside your
AParamDelegateListener::BeginPlay
function, change the call toBindUObject
to the following:MyGameMode->MyParameterDelegate.BindUObject(this, &AParamDelegateListener::SetLightColor, false);
Change the declaration of
SetLightColor
to this:void SetLightColor(FLinearColorLightColor, bool EnableLight);
Alter the implementation of
SetLightColor
as follows:void AParamDelegateListener::SetLightColor(FLinearColorLightColor, bool EnableLight) { ...