# Timeline wont call binded function with AddInterpFloat

**URL:** <https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327>\
**Category:** C++\
**Tags:** timeline, unreal-engine, question\
**Created:** [March 12, 2024, 9:56pm UTC](https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327 "2024-03-12T21:56:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Korred1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Korred1](https://forums.unrealengine.com/u/Korred1)\
**Post date:** [March 12, 2024, 9:56pm UTC](https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327/1 "2024-03-12T21:56:40Z")

</div>

Hi  
My timeline wont call binded function. Code looks like this

.h file

```auto
	FTimeline MovementTimeline;
	UCurveFloat* MovementCurve;

```

.cpp

constructor

```auto
	static ConstructorHelpers::FObjectFinder<UCurveFloat> CurveAssetFinder(TEXT("/Game/Map/Curve_mov"));

```

BeginPlay()

```auto
	FOnTimelineFloat timelineProgress;
	timelineProgress.BindUFunction(this, FName("ProcessMovementTimeline"));

	FOnTimelineEvent timelineEnded;
	timelineProgress.BindUFunction(this, FName("ProcessMovementEnd"));

	MovementTimeline.AddInterpFloat(MovementCurve, timelineProgress);
	MovementTimeline.SetTimelineFinishedFunc(timelineEnded);

	MovementTimeline.SetTimelineLengthMode(TL_LastKeyFrame);

```

Tick()

```auto
void ABaseUnit::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	if (pathUpdated)
	{
		MovementTimeline.Stop();
		UpdatePath();
		MovementTimeline.PlayFromStart();
	}

	if (MovementTimeline.IsPlaying())
	{
		UE_LOG(LogTemp, Log, TEXT("MovementTimeline.IsPlaying()"));
		MovementTimeline.TickTimeline(DeltaTime);
	}
}

```

binded function

```auto
void ABaseUnit::ProcessMovementTimeline(float Value)
{
	UE_LOG(LogTemp, Log, TEXT("ABaseUnit::ProcessMovementTimeline"));

	const float SplineLength = spline->GetSplineLength();

	const FVector CurrentSplineLocation = spline->GetLocationAtDistanceAlongSpline(Value * SplineLength, ESplineCoordinateSpace::World);
	FRotator CurrentSplineRotation = spline->GetRotationAtDistanceAlongSpline(Value * SplineLength, ESplineCoordinateSpace::World);

	CurrentSplineRotation.Pitch = 0.f;
	SkeletalMeshComponent->SetWorldLocationAndRotation(CurrentSplineLocation, CurrentSplineRotation);
}

```

There are simply no logs

```auto
UE_LOG(LogTemp, Log, TEXT("ABaseUnit::ProcessMovementTimeline"));

```

but these are shown

```auto
UE_LOG(LogTemp, Log, TEXT("MovementTimeline.IsPlaying()"));

```

so therefore function is not beeing called. Does anyone seems to know what is the problem?  
BR

---

<div class="post-metadata">

**Author:** ![Scienziatogm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scienziatogm/32/906600_2.png) [@Scienziatogm](https://forums.unrealengine.com/u/Scienziatogm)\
**Post date:** [March 12, 2024, 11:11pm UTC](https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327/2 "2024-03-12T23:11:37Z")

</div>

Hey Korred,  
Does pathUpdated value change (to false maybe?) inside the UpdatePath() method? And why are you playing the timeline on event tick?  
Have you tried using the Visual Studio debugger to see why the timeline is not calling the bound function? Try to add a breakpoint on the MovementTimeline.PlayFromStart() row and follow the code path

---

<div class="post-metadata">

**Author:** ![Korred1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Korred1](https://forums.unrealengine.com/u/Korred1)\
**Post date:** [March 13, 2024, 7:36pm UTC](https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327/3 "2024-03-13T19:36:26Z")

</div>

Logic and setting bool values is ok, I only have problem with this callbac function. I made some porgress but still not working properly.  
What i did was

```auto
	FOnTimelineFloat timelineProgress;
	timelineProgress.BindUFunction(this, FName("ProcessMovementTimeline"));
	timelineProgress.ExecuteIfBound(1.0f);
	timelineProgress.Execute(1.0f);

```

And it threw error that function cannot be found, so moved function to public and added UFUNCTION() property. This way these two Execute functions were called properly but in Tick() my function is still not beeing called.  
Regarding debugging i have problem that i cant ‘step into’ UE function, it just skips to next line

---

<div class="post-metadata">

**Author:** ![Scienziatogm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scienziatogm/32/906600_2.png) [@Scienziatogm](https://forums.unrealengine.com/u/Scienziatogm)\
**Post date:** [March 13, 2024, 9:58pm UTC](https://forums.unrealengine.com/t/timeline-wont-call-binded-function-with-addinterpfloat/1748327/4 "2024-03-13T21:58:04Z")

</div>

Are you using DebugGame configuration when debugging? Otherwise the code is getting optimized and some lines are skipped on debugging.  
Anyway instead of using BindUFunction try to use

```Cpp
timelineProgress.BindDynamic(this, &ThisClass:ProcessMovementTimeline);

```

I think it’s cleaner
