Hey, I have a BP with child actors. Trying to bind a UFunction to the child actors delegate doesn`t seem to work. The invocation list is filled properly, but the IsBound() check right before the function call returns false for some reason.
Here is the code sample:
//MyChildActor.h
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMyDestruction, AMyChildActor*, WhoIsDestroyed);
public:
UPROPERTY(BlueprintAssignable, Category = "MyCategory")
FOnMyDestruction OnMyDestruction;
//MyChildActor.cpp
OnMyDestruction.Broadcast(this);
//MyBinder.h
UFUNCTION()
void OnBindedDestroyed(AMyChildActor* WhoIsDestroyed );
//MyBinder.cpp
TArray<AActor*> ActorToBind;
GetOverlappingActors(ActorToBind, AMyChildActor::StaticClass());
for (auto& ToBind: ActorToBind)
{
AMyChildActor* CastedBinded = Cast<AMyChildActor>(ToBind);
CastedStructure->OnMyDestruction.AddDynamic(this, &AMyBinder::OnBindedDestroyed);
}
I also tried binding it in BPs and it doesn’t seem to work.