Hello! I’m late to the party but I’m trying to do something similar.
So far I’ve managed to add a spawnable, add an event track to it and add a section to the event track. I’m now trying to create the event from C++ and I can’t figure how to do. Can anyone give me a hand?
here is my code so far :
// fetch sequence and blueprint to spawn
UEditorAssetLibrary::CheckoutAsset("/Game/Python/PythonSequence");
UObject* mySequenceObject = UEditorAssetLibrary::LoadAsset("/Game/Python/PythonSequence");
UMovieSceneSequence* myMovieSceneSequence = Cast<UMovieSceneSequence>(mySequenceObject);
UMovieScene* myMovieScene = myMovieSceneSequence->GetMovieScene();
// Fetch blueprint and add as spawnable in sequence
UObject* myBlueprintObject = UEditorAssetLibrary::LoadAsset("/Game/Blueprints/BP_RandomNumberGenerator");
FGuid mySpanwableGuid = myMovieSceneSequence->CreateSpawnable(myBlueprintObject);
// Add an event track to the spawnable
UMovieSceneTrack* myTrack = myMovieScene->AddTrack(UMovieSceneEventTrack::StaticClass(), mySpanwableGuid);
// Add a section to the event track
UMovieSceneSection* mySection = myTrack->CreateNewSection();
myTrack->AddSection(*mySection);
UMovieSceneEventSection* myEventSection = Cast<UMovieSceneEventSection>(mySection);
// Add a key to the section
// TODO
Thanks in advance!