ALevelSequenceActor -> ULevelSequence

This should be simple, but I can’t find out.
Having an existing ALevelSequenceActor, I want to get the ULevelSequence (and then the UMovieScene with tracks and sections).
But the ALevelSequenceActor has no method to give me a ULevelSequence pointer.
How would I get this object, having an already loaded ULevelSequence visible in the sequencer?

The ALevelSequenceActor holds the played sequence in a string asset reference instead of a raw pointer. We do this so that there’s no hard dependency from sequence actors to sequences, which will allow us to load the sequence on demand.

To resolve the asset reference, do this:

ULevelSequence* LevelSequenceAsset = Cast<ULevelSequence>(MyLevelSequenceActor->LevelSequence.ResolveObject());

This will return nullptr if the object isn’t loaded yet. To force it to load, you can do this:

ULevelSequence* LevelSequenceAsset = Cast<ULevelSequence>(MyLevelSequenceActor->LevelSequence.TryLoad());

Note that the asset may be nullptr if it is not set or cannot be loaded for some reason. For convenience, I will add a GetSequence() method for 4.13.

Here’s what I added for 4.13…

In LevelSequenceActor.h:

UFUNCTION(BlueprintCallable, Category="Game|Cinematic")
ULevelSequence* GetSequence(bool Load = false) const;

In LevelSequenceActor.cpp:

ULevelSequence* ALevelSequenceActor::GetSequence(bool Load) const
	return Cast<ULevelSequence>(Load ? LevelSequence.TryLoad() : LevelSequence.ResolveObject());

Aaah, great, that’s working fine. :slight_smile:
Thank you for the fast answer and let me say, that sequencer is a great achievement.
Well done architecture with love to details. For example the loop playing even with small buffers is amazing.