So far, the delegates that we've used haven't taken any input parameters. This recipe shows you how to change the signature of the delegate so that it accepts some input.
Be sure you've followed the recipe at the beginning of this chapter, which shows you how to create a TriggerVolume
and the other infrastructure that we require for this recipe.
Add a new delegate declaration to
GameMode
:DECLARE_DELEGATE_OneParam(FParamDelegateSignature, FLinearColor)
Add a new member to
GameMode
:FParamDelegateSignatureMyParameterDelegate;
Create a new
Actor
class calledParamDelegateListener
. Add the following to the declaration:UFUNCTION() void SetLightColor(FLinearColorLightColor); UPROPERTY() UPointLightComponent* PointLight;
In the class implementation, add this to the constructor:
PointLight = CreateDefaultSubobject<UPointLightComponent>("PointLight"); RootComponent = PointLight;
In the
ParamDelegateListener.cpp
file, add#include...