For my project, I have a damageable component that I want to call whenever I want an actor to take damage (I’m Aware of Apply Damage). I want this function to be changeable depending on what actor is using the DamageableComponent. Delegates seem to be what I need to accomplish this. I’ve created a very basic example based on the post below.
In my actor blueprint, I bind this example event on BeginPlay and print out the damage value passed to it. The issue occurs that for the first shot that hits the character the event is called successfully and the damage is printed out. However, the event will not successfully be called again. You can see some of my implementation below.
Declaration
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FExampleDelegate_OnSomething, float, _exampleEventParameter);
UPROPERTY(BlueprintAssignable)
FExampleDelegate_OnSomething ExampleDelegateVariable;
Implementation
DamageableComponent->ExampleDelegateVariable.Broadcast(1000);
It seems like after the event has succeeded the event is being unbound from the function. Which doesn’t seem like the correct behavior to me. If I call Bind on Tick instead of BeginPlay it works as expected, however, that also doesn’t seem like the correct behavior. In the engine source, I have tried placing breakpoints on every remove trying to figure out when/where it may have been removed however none of them were hit.
Any insight would be appreciated