How to Make a Function that Convert Runtime Float Curve into a Float Curve object

Hello there , Im trying to find a way to convert a Runtime Float Curve into a Float Curve ( which could be used as to the Set Curve to a Timeline. I’m not a pro on unreal C++ ; so i suck at this early time

here is so far i did and error im facing



You can create a curve asset at runtime.

UPROPERTY(EditInstanceOnly, Category = "Timeline")
FRuntimeFloatCurve Curve;

UPROPERTY(Transient)
TObjectPtr<UCurveFloat> CurveAsset;
void AMyActor::PostInitializeComponents()
{
	Super::PostInitializeComponents();

	if (GetWorld()->IsGameWorld())
	{
		UCurveFloat* NewCurve = NewObject<UCurveFloat>(this, NAME_None, RF_Transient);
		NewCurve->FloatCurve = *Curve.GetRichCurve();
		CurveAsset = NewCurve;

		TimelineComponent->AddInterpFloat(CurveAsset, FOnTimelineFloatStatic::CreateUObject(this, &ThisClass::OnTimelineFloat));
	}
}