Add sequencer tracks from code?

I am trying to script some sequencer functions, with varying success.
What parameters does the AddTrack function need?

ULevelSequence *LevelSequence;
LevelSequence->MovieScene->AddTrack(???);

the header file is:

	UMovieSceneTrack * AddTrack
(
    TSubclassOf < UMovieSceneTrack > TrackClass,
    const FGuid & ObjectGuid
)

Thanks!

First one is type of track you want to create, look up “Inheritance Hierarchy” in UMovieSceneTrack, you will find list of all track classes. Same as in SpawnActor you use StaticClass() static function to get class of track

2nd (i guess, im not 100% sure) is guid of object that track will relate to, you can get it using this function:

FUniqueObjectGuid::GetOrCreateIDForObject(YourObject).GetGuid();

So for example:

FGuid MyGuid  = FUniqueObjectGuid::GetOrCreateIDForObject(YourObject).GetGuid();
LevelSequence->MovieScene->AddTrack(UMovieSceneAudioTrack::StaticClass(), MyGuid);

Will create audio track for YourObject object (which is UObject or AActor pointer)

Thanks! That gets me closer. I have:

LevelSequence->MovieScene->AddTrack(UMovieScene3DTransformTrack::StaticClass(),Guid);

but intelsense copmplains at UMovieScene3DTransformTrack::StaticClass, giving:

incomplete type is not allowed

You mean UMovieScene3DTransformTrack::StaticClass() you used ()? If yes then include header file containing the class

ah yes! I had the TrackInstances header, instead of the track header. Thank you again!

Sorry… one last thing… for LevelSequence->MovieScene->FindTrack

template<typename TrackClass>
TrackClass * FindTrack
(
    const FGuid & ObjectGuid,
    const FName & TrackName
)

What should I pass for the Guid?

Could you give more info how you finally added the tracks from C++? I am trying to use AddTrack() and AddMasterTrack() and it returns nullptr