Quick answer: Create a UTimelineComponent in C++ and call Play in BeginPlay. Blueprint-only Timelines aren’t directly callable from C++ — use the component-based equivalent.
A door BP has a Timeline opening it. You want to trigger this from a C++ controller. Direct access to the Timeline isn’t exposed. The Blueprint-only Timeline is internal to the Blueprint VM.
UTimelineComponent in C++
// In header
UPROPERTY()
UTimelineComponent* OpenTimeline;
UPROPERTY(EditAnywhere)
UCurveFloat* OpenCurve;
// Constructor
ADoor::ADoor() {
OpenTimeline = CreateDefaultSubobject<UTimelineComponent>(TEXT("OpenTimeline"));
}
// BeginPlay
void ADoor::BeginPlay() {
Super::BeginPlay();
FOnTimelineFloat updateFn;
updateFn.BindDynamic(this, &ADoor::OnTimelineUpdate);
OpenTimeline->AddInterpFloat(OpenCurve, updateFn);
OpenTimeline->SetLooping(false);
}
// Trigger
void ADoor::Open() {
OpenTimeline->Play();
}
// Callback per tick
UFUNCTION()
void ADoor::OnTimelineUpdate(float Value) {
SetActorLocation(StartLoc + FVector(0, 0, Value * 100));
}
Component-based, callable from anywhere. Plays a UCurveFloat over its assigned duration.
Calling Blueprint Functions from C++
If the Timeline lives in a Blueprint and you can’t port:
UFunction* func = doorActor->FindFunction(TEXT("OpenDoor"));
if (func) {
doorActor->ProcessEvent(func, nullptr);
}
Calls the Blueprint OpenDoor function (which can in turn play its Timeline). Awkward but works without porting.
BlueprintCallable Wrapper
A cleaner alternative: mark the BP function BlueprintCallable and use the generated reflection:
IDoorActor::Execute_OpenDoor(doorActor); // if interface-based
Or assign the door BP to a UPROPERTY of an interface type and call its method — routes through Blueprint normally.
Verifying
Trigger Open from C++. Door should animate. Print UE_LOG at Play call to confirm it’s reached. If the actor is selected, the Timeline track visualization should advance in the editor.
“Blueprint Timelines and C++ Timelines are different APIs. Convert to UTimelineComponent for cross-language access, or call BP functions via reflection.”
For doors and other simple lerps, a manual FMath::Lerp in Tick is often simpler than a Timeline component.