Hm it seems it doesn’t work. I setup simple code, to check how it is going to work and it seems like the event is not broadcasted to blueprint.
DECLARE_DYNAMIC_MULTICAST_DELEGATE( FCharacterHealthChange);
UPROPERTY(BlueprintAssignable)
FCharacterHealthChange OnCharacterHealthChange;
An in implementation:
void ARPGCharacter::ModifyAtrribute(FCharacterAttributes modAttri, bool damage)
{
if(damage)
{
Attributes.Health = Attributes.Health - modAttri.Health;
Attributes.Endurance = Attributes.Endurance - modAttri.Endurance;
Attributes.Energy = Attributes.Energy - modAttri.Energy;
}
else
{
Attributes.Health = Attributes.Health + modAttri.Health;
Attributes.Endurance = Attributes.Endurance + modAttri.Endurance;
Attributes.Energy = Attributes.Energy + modAttri.Energy;
}
OnCharacterHealthChange.Broadcast();
}
And here simple blueprint:
Just to be clear
OnCharacterHealthChange.Broadcast();
Is triggered, as far as I can tell while debugging breakpoints.
Maybe the issue is that the delegate is not bound ? But if so how do I bind delegate that do not need to trigger any functions ?
I see only BindDynamic macto and it require object, and function.
Edit:
Binding event in blueprint works.
But how do I bind delegate that do not take any functions in code ?
