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!
1 Like
Hi there, I hope you’re having a good day.
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"));
}
1 Like
Good day!
Thank you for helping me. I will try it later on my new project! thank you so much!!!
1 Like
Good day!
If you have any problems, please let me know
1 Like
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?