Hi, is it possible to edit ULevelSequence at runtime? I’m able to add an event track to a level sequence and then add keyframe to it. The event gets fired in PIE and standalone mode but not in packaged build. Here’s a code snippet that I’m using:
//Struct with function parameters
USTRUCT(BlueprintType)
struct FInputParams
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 InputParam;
};
UMovieSceneEventTrack* EventTrack = NewObject<UMovieSceneEventTrack>(this, UMovieSceneEventTrack::StaticClass());
UMovieSceneEventSection* EventSection = NewObject<UMovieSceneEventSection>(EventTrack, UMovieSceneEventSection::StaticClass());
if (!EventSection)
{
UE_LOG(LogTemp, Error, TEXT("Event Section is not valid"));
return;
}
EventTrack->AddSection(*EventSection);
FEventPayload Payload;
Payload.EventName = "CalledFromSequencer"; //Function must be in level blueprint
FInputParams ParamsToPass;
ParamsToPass.InputParam = 7; //Test value
UScriptStruct* PayloadProperty = StaticStruct<FInputParams>();
Payload.Parameters.Reassign(PayloadProperty);
Payload.Parameters.OverwriteWith((uint8*)&ParamsToPass);
FMovieSceneChannelProxy& Proxy = EventSection->GetChannelProxy();
FMovieSceneEventSectionData* Channel = Proxy.GetChannel<FMovieSceneEventSectionData>(0);
if (!Channel)
{
UE_LOG(LogTemp, Error, TEXT("Channel is not valid"));
return;
}
TMovieSceneChannelData<FEventPayload> ChannelData = Channel->GetData();
int32 KeyIndex = ChannelData.AddKey(10 * 1000 /*Adds this key to 10th frame */, Payload);
UE_LOG(LogTemp, Warning, TEXT("Newly added key index: %d"), KeyIndex);
Any help will be appreciated!