Is there a “Finished” event for a Level Sequence? Or do I have to check IsPlaying every tick? Or even add a custom track event at the end of each sequence?
Matinee used to have a “Finished” pin on its blueprint controller, but there is no such thing for a sequence.
There isn’t a “Finished” event. That looks to be an oversight. I’ve added jira UETOOL-899 and we’ll try to get it into the next release. Thanks for pointing it out.
Has this been resolved in 4.12? I am trying to trigger something off the end of a Sequence playing, and was also looking for the equivalent of the Matinee Controller’s Finished pin.
It’s not an “event” per se, you don’t have to listen to it. You just enter its name and create a custom event in the level blueprint with the same name.
Here’s my solution using coroutines. I needed a way to find out when a looping level sequence has reached the end of the timeline, and unfortunately the OnFinished and OnStop delegates don’t fire if the sequence is looping.
UE5Coro::TCoroutine<> USequencerTask::StartSequenceTimer()
{
// ensure the delegate never fires more than once per loop
bool bHasBroadcast = false;
while (IsValid(SequencePlayer) && SequencePlayer->IsPlaying())
{
const float CurrentTime = SequencePlayer->GetCurrentTime().AsSeconds();
const float EndTime = SequencePlayer->GetEndTime().AsSeconds();
if (bHasBroadcast && CurrentTime <= 0.1)
{
bHasBroadcast = false;
}
if (!bHasBroadcast && CurrentTime >= EndTime - 0.1f)
{
OnSequencePlayerLoop.Broadcast();
bHasBroadcast = true;
}
co_await UE5Coro::Latent::NextTick();
}
co_return;
}