Declaring Delegates For Blueprint¶
Introduction¶
Delegate¶
Can be dynamic, multicast, return or not and can have params.
Examples:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_RetValue_OneParam
DECLARE_MULTICAST_DELEATE_TwoParams
Events¶
Similar to delegate, but cannot be dynamic. It’s C++ only (No Blueprint) so more performant.
Example:
DECLARE_EVENT_OneParam
DECLARE_EVENT_SixParam
Add Multicast Delegate to project¶
Change QuestManager.h
Above class declaration add:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCompletedQuestSignature, int32, Index);
And inside public, add
UPROPERTY(BlueprintAssignable, BlueprintCallable) FCompletedQuestSignature CompletedQuest;
Compile and we’ll see under Event Dispatcher that CompletedQuest is renamed to CompletedQuest_0
Find references to CompletedQuest
Go to CompletedQuest_0, Find References as we’ll see there are no references.
Click on the goggle and instead search for CompletedRequest
Replace Call Completed Quest 0 with Call Completed Quest.
Compile QuestManager and QuestMarker