How do I play Level Sequence in c++?

Good day to all. I currently have a LevelSequence in my editor. I want to control it in c++. How would I play my LevelSequence in c++? Thank you in advance!

Hi there, I hope you’re having a good day. :slight_smile:
So, if I get your question right, you can control a level sequence with something like this (I put some comments on the code to better explanation):
MyActor.h

// Making this a EditAnywhere will show a dropdown in your actor Blueprint where you can select the level sequence that you want.
UPROPERTY(EditAnywhere)
ULevelSequence* LevelSequence;

MyActor.cpp

// Create a level sequence player
ULevelSequencePlayer* LevelSequencePlayer = ULevelSequencePlayer::CreateLevelSequencePlayer(GetWorld(), LevelSequence, FMovieSceneSequencePlaybackSettings(), OutActor);

// Check if the player was created successfully
if (LevelSequencePlayer)
{
    // Play the level sequence
    LevelSequencePlayer->Play();
}
else
{
    UE_LOG(LogTemp, Error, TEXT("Unable to create level sequence player"));
}

Good day!

Thank you for helping me. I will try it later on my new project! thank you so much!!!

Good day!
If you have any problems, please let me know

Hi, sorry to start this topic again, but for me is says that UMovieSceneSequencePlayer::Play() is an unresolved external. How do I fix this? I’ve added the headers and added the “LevelSequence” modules to the .cs.build file to try and fix it. No luck.

You’ll also need to add MovieScene as a dependent module in the build.cs file. Can you try that?