1.c++定义多播委托,示例代码:
#include "Delegates/Delegate.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMyDelegate, UObject*, SelectAgent);
/**
*
*/
UCLASS(Blueprintable, DisplayName = "VM_PlaceEntity")
class PR_PLACEENTITY_MODEL_API UVM_PlaceEntity : public UMVVMViewModelBase
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, FieldNotify, Setter, Getter)
UObject* SelectAgent;
UPROPERTY(BlueprintAssignable, Category = "VM_PlaceEntity")
FMyDelegate MulticastDelegate_SelectAgent;
private:
void SetSelectAgent(UObject* Value) { UE_MVVM_SET_PROPERTY_VALUE(SelectAgent, Value); MulticastDelegate_SelectAgent.Broadcast(Value); }
UObject* GetSelectAgent() const { return SelectAgent; }
};
2. 蓝图使用