1. 委托的声明

  

//这个要写在类外,头文件中,且委托名一定是以F开头,这里的委托名是FTheEvent
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FTheEvent);

//含有一个参数的委托写法,ESequenceItem是类型名,TargetMission是变量名
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMissionFinish, ESequenceItem, TargetMission);

...

public: 
    
//BlueprintAssignable是蓝图可绑定事件,BlueprintCallable是蓝图可调用此委托
    UPROPERTY(BlueprintAssignable, BlueprintCallable)
        FMissionFinish TargetMissionFinish;
    

    UPROPERTY(BlueprintAssignable)
        FTheEvent TargetEvent;

 

2. 委托的使用

  

//Broadcast是调用,MyMission是类型名为ESequenceItem的变量,是此委托的参数
TargetMissionFinish.Broadcast(MyMission);