Delegate not receiving the correct parameter

I’m updating a project from UE4.27 to UE5.5 but got an issue with my delegates.
The idea is to use delegates to modify the final damage based on what equipments the character is using. Therefore, we may add or remove formulas to the damage calculation. I’ve omitted the unbind functions to shorten this post.

Here’s the signature:

DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(float, FOnReturnFloatSignature, float, FloatValue);

Player.h

TArray<FOnReturnFloatSignature> OnBeforeHurtDelegates;

UFUNCTION(BlueprintCallable, Category = "Base Player Character (C++)")
void BindToOnBeforeHurt(UObject* InObject, const FName& FunctionName);

UFUNCTION(BlueprintCallable, Category = "Base Player Character (C++)")
float CallOnBeforeHurt(const float CurrentDamage);

Player.cpp

void ABasePlayerCharacter::BindToOnBeforeHurt(UObject* InObject, const FName& FunctionName)
{
	if(OnBeforeHurtDelegates.Num() == 0 || OnBeforeHurtDelegates.Last().IsBound())
	{
		FOnReturnFloatSignature& Instance = OnBeforeHurtDelegates.AddDefaulted_GetRef();
		Instance.BindUFunction(InObject, FunctionName);
	}
	else
	{
		OnBeforeHurtDelegates.Last().BindUFunction(InObject, FunctionName);
	}
}

float ABasePlayerCharacter::CallOnBeforeHurt(const float CurrentDamage)
{
	float ReturnVal = CurrentDamage;

	for(int32 i{0}; i < OnBeforeHurtDelegates.Num(); i++)
	{
		if(OnBeforeHurtDelegates[i].IsBound())
		{
			FString str = OnBeforeHurtDelegates[i].GetFunctionName().ToString();
			ReturnVal = OnBeforeHurtDelegates[i].Execute(ReturnVal);
		}
	}
	return ReturnVal;
}

The delegates are blueprints functions as such (one of them):


The issue:
I’m not sure why, but after the update, the values inside the CoatDamageReduction are always 0.

Here’s what I’ve already tried:

  • Checked if the ReturnVal in OnBeforeHurtDelegates[i].Execute(ReturnVal) is indeed not 0, it is.
  • Directly call the CoatDamageReduction instead of binding, it works as expected
  • The CoatDamageReduction is being called and ran, only the parameter it receives is 0
  • Instead of using arrays, a simple delegate instead, same issue.

I suspect that something about the BindUFunction() has changed on UE5.. What can I do to fix this bizarre issue?

So, turns out that the delegate passes the correct parameters only if I’m using a C++ function. If I try to pass a blueprint function’s name to BindOnBeforeHurt, the delegate is unable to pass the parameters and the function uses the default value…