Cissoid
(Cissoid)
1
Hello,
I wrote an ActorCmponent for a Questbook, now i want to add delegates for quest add, remove and update.
I want to bind the event in other classes.
How i can do this?
I tried DECLATE_DELEGATE but it didn’t work, i got errors like, isn’t a type like UCLASS UENUM etc.
Thank you.
rantrod
(rantrod)
2
May be of help:
Can you post code showing how you’re using DECLARE_DELEGATE?
Cissoid
(Cissoid)
3
this is my solution now:
.h
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnGotQuest, FQuestItem, QuestBook);
UCLASS(ClassGroup = (Custom), BlueprintType ,meta = (BlueprintSpawnableComponent))
class PROJECTX_API UQuestBook : public UActorComponent
{
GENERATED_BODY()
public:
.......
UFUNCTION(BlueprintCallable, Category = QuestBookFunctions)
void AddQuest(FQuestItem questItem);
UPROPERTY(BlueprintAssignable, Category = CharakterProperties)
FOnGotQuest GotQuest;
...........
.cpp
void UQuestBook::AddQuest(FQuestItem questItem)
{
QuestItems.Add(questItem);
GotQuest.Broadcast(questItem);
}
this is the blueprint binding (looks a little bit strange)