Level Sequence played in reverse will crash built game, or cause assert in editor

Hello. I have a level with multiple Level Sequences which I use to control various camera animations. I’ve created a BlueprintLibrary to contain the camera functions, there’s a play, a play reverse, a GotoStart and a GotoEnd function. (The PlayReverse blueprint is pictured below.)

Opening a menu will play a sequence and move the camera to a new location.
When I exit that menu, I play that level sequence in reverse to return the camera to the ‘home’ position, however this will cause a crash in built versions of the game.
If I press F5 in VS to attach the debugger to the engine, when the sequence has finished, I’ll get an exception and VS will highlight line 1172 of MovieSceneSequencePlayer.cpp.

Pressing continue will continue on, but this level sequence will not play in either direction again until the game is restarted. (The same thing happens if I open the UProject, only without the VS debugging.)

I’ve tried limiting the start/end positions using a Set Play Range node, I’ve tried adding blank fames to the start/end of the sequence, nothing has fixed this crash.

Can anyone think of what I’m doing wrong?

Here’s a copy of my blueprint (Its a function in a blueprint library that I call to play a sequence. Playing forwards always works, play reverse always fails):

Ok, so I didn’t fix the issue, but I tried reusing a single LevelSequenceActor placed in the scene, and making reversed copies of Level Sequences instead of trying to play them in reverse. I also removed the Blueprint Library and used local copies of the ‘Play’ function in case that was the issue.

Now it seems to cause an assertion failed error when it’s called with a new Sequence. (The sequence attached to the LevelSequenceActor in the scene will work fine, but new sequences will immediately cause the following assertion failed crash.

Again, this only occurs IN BUILDS, not in editor.

Assertion failed: StartIndex >= 0 && StartIndex <= Array.Num() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Containers\BitArray.h] [Line: 1816] 


Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffffffffffff

0x00007ff78309c897 McNugget.exe!FMovieSceneSpawnRegister::ForgetExternallyOwnedSpawnedObjects() []
0x00007ff783010021 McNugget.exe!UE::MovieScene::FSequenceInstance::Finish() []
0x00007ff782f850c9 McNugget.exe!FMovieSceneEntitySystemRunner::QueueFinalUpdateImpl() []
0x00007ff782f84ee8 McNugget.exe!FMovieSceneEntitySystemRunner::QueueFinalUpdate() []
0x00007ff7830c3cd5 McNugget.exe!UMovieSceneSequencePlayer::StopInternal() []
0x00007ff7830a71a4 McNugget.exe!UMovieSceneSequencePlayer::Initialize() []
0x00007ff783af851a McNugget.exe!ULevelSequencePlayer::Initialize() []
0x00007ff783b01b0b McNugget.exe!ALevelSequenceActor::execSetSequence() []
0x00007ff77ed548b9 McNugget.exe!UFunction::Invoke() []
0x00007ff77f0380d4 McNugget.exe!UObject::CallFunction() []
0x00007ff77f04afc2 McNugget.exe!UObject::ProcessContextOpcode() []
0x00007ff77f04e998 McNugget.exe!ProcessLocalScriptFunction() []
0x00007ff77f0261c5 McNugget.exe!ProcessScriptFunction<void (__cdecl*)(UObject * __ptr64,FFrame & __ptr64,void * __ptr64)>() []
0x00007ff77f04e4de McNugget.exe!ProcessLocalFunction() []
0x00007ff77f04e998 McNugget.exe!ProcessLocalScriptFunction() []
0x00007ff77f0261c5 McNugget.exe!ProcessScriptFunction<void (__cdecl*)(UObject * __ptr64,FFrame & __ptr64,void * __ptr64)>() []
0x00007ff77f04e4de McNugget.exe!ProcessLocalFunction() []
0x00007ff77f04e998 McNugget.exe!ProcessLocalScriptFunction() []
0x00007ff77f04dbbc McNugget.exe!UObject::ProcessInternal() []
0x00007ff77ed548b9 McNugget.exe!UFunction::Invoke() []
0x00007ff77f04c82a McNugget.exe!UObject::ProcessEvent() []
0x00007ff783851443 McNugget.exe!UUserWidget::NativeDestruct() []
0x00007ff786dc0562 McNugget.exe!UCommonActivatableWidget::NativeDestruct() []
0x00007ff78386a409 McNugget.exe!SObjectWidget::ResetWidget() []
0x00007ff783830f67 McNugget.exe!SObjectWidget::~SObjectWidget() []
0x00007ff786dfaf91 McNugget.exe!`FUserWidgetPool::GetOrCreateInstance<UCommonActivatableWidget>'::`2'::<lambda_1>::operator()() []
0x00007ff77e4187e3 McNugget.exe!FTSTicker::Tick() []
0x00007ff785d580ef McNugget.exe!FEngineLoop::Tick() []
0x00007ff785d6d42c McNugget.exe!GuardedMain() []
0x00007ff785d6d4fa McNugget.exe!GuardedMainWrapper() []
0x00007ff785d700c5 McNugget.exe!LaunchWindowsStartup() []
0x00007ff785d803a4 McNugget.exe!WinMain() []
0x00007ff78b1e3b82 McNugget.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
0x00007ff8182d257d KERNEL32.DLL!UnknownFunction []

Why is it so hard trying to use these things?!
Surely someone knows something that can help?

This sounds similar to an issue that was patched in 5.4.2. For that particular issue, we had a bug report about subframe duration sequences not looping and it would hit this assert. What version are you using?

Thank you for replying. We appear to be using 5.4.2.

I was never able to fix this issue and resorted to creating a new Level Sequence Actor for each Sequence I wanted to play, then cleaning up all the Level Sequence Actors whenever the menu screen changes to prevent the build-up of loose actors.

It’s horrible, but it works.

We’ll investigate further on our side. I’ve added a bug report and you can track it when it is made public here: Unreal Engine Issues and Bug Tracker (UE-220346)