Using Multicast Delegates with BlueprintImplementableEvent

Hello,

I’m having trouble hooking up a Multicast Delegate to a BlueprintImplementableEvent function, for a simple health/armor display. I’m doing it in C++ for maintainability purposes :slight_smile:

Here’s the code I have:

On my character header:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHealthChanged, float, Health, float, Armor);

UPROPERTY(BlueprintAssignable)
FOnHealthChanged OnHealthChanged;

(I’m not sure if BlueprintAssignable is needed there, since I"m trying to assign it using C++, even though it will execute blueprint code. Left it in anyway. Advice is welcome :slight_smile: )

At the end of my TakeDamage function, on my character:

OnHealthChanged.Broadcast(Health, Armor);

And on my custom UUserWidget, I declare on my header:

UFUNCTION(BlueprintImplementableEvent)
void HealthChanged(float Health, float Armor);

And on CPP:

void UHavenBaseHealthArmorWidget::NativeConstruct()
{
Super::NativeConstruct();

// There are sanity checks in here, making sure all pointers are fine.

MyCharacter->OnHealthChanged.AddDynamic(this, &UBaseHealthArmorWidget::HealthChanged);

}

But when I damage myself, nothing happens. If I set a breakpoint tin the blueprint, it seems it’s not executed. If I set a breakpoint on my character TakeDamage function, the function is being called.

I’m not sure what I"m missing there to make it work. Any idea of what’s wrong and how I should fix it?

Thank you very much in advance!

EDIT: I created a topic on UE4 forums regarding this issue:
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1387754-using-multicast-delegates-with-blueprintimplementableevent