In my project, I’m creating a timeline from an existing curve in C++ following this tutorial: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
However, I wanted to use a Static delegate and BindUObject instead of a Dynamic delegate and BindUFunction.
Compared to the tutorial, I used the modified lines:
FOnTimelineFloatStatic InterpFunction{}; // instead of FOnTimelineFloat
// use BindUObject and method reference instead of BindUFunction and "TimelineFloatReturn"
InterpFunction.BindUObject(this, &MyClass::TimelineFloatReturn);
ScoreTimeline->AddInterpFloat(fCurve, InterpFunction);
I was expecting the compiler to use the overload for Static delegates:
ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloatStatic InterpFunc );
but apparently it doesn’t find it and instead tries to resolve the overload for the Dynamic delegate:
ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloat InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None)
which gives the following error message:
error C2664: 'void UTimelineComponent::AddInterpFloat(UCurveFloat
*,FOnTimelineFloat,FName,FName)': cannot convert argument 2 from 'FOnTimelineFloatStatic' to 'FOnTimelineFloat'
Why is the overload resolution incorrect? Is that related to the default arguments?
I also tried to use BindUFunction (passing the function name) with my Static delegate, as in this other question, but I still got the same error.
Note: I am using hot reload, and the first time I tried to hot reload I had the 2 extra parameters PropertyName and TrackName that should only be for the Dynamic delegate overload. However, after removing, the error remained.