So im having an actor with constructor that adds method to dynamic multicast delegate declared as
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FInteractionHandler, class AActor*, ActorInteracting);
UPROPERTY(BlueprintAssignable, BlueprintCallable, VisibleAnywhere, Category = Interaction)
FInteractionHandler OnInteract;
//Delegate being called by Interface method Activate, allows behaviour modifable by blueprints
UPROPERTY(BlueprintAssignable, BlueprintCallable, VisibleAnywhere, Category = Interaction)
FInteractionHandler OnActivate;
And Constructor with method:
AInventoryOnTheGround::AInventoryOnTheGround(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
Mesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, "Mesh");
RootComponent = Mesh;
OnInteract.AddDynamic(this, &AInventoryOnTheGround::InteractionReaction);
}
void AInventoryOnTheGround::InteractionReaction(AActor* ActorInteracting)
{
UInventoryComponent* InventoryComponent = nullptr;
InventoryComponent = ActorInteracting->FindComponentByClass<UInventoryComponent>();
if (InventoryComponent)
{
InventoryComponent->PickItem(DataObjectInstance);
this->Destroy();
}
}
The problem that i have is that it seems that when i add delegate to OnInteract its also being added to OnActivate
Removing the line form the constructor removes the delegate from both events. So i guess i kinda found a bug. Or i messed something up.