LevelSequenceActor data migration

While updating a project to 5.6 (across multiple versions), we encountered a pretty hard-to-debug problem with LevelSequenceActors to do with data migration from before 5.3 (I believe). Essentially, the migration that occurs in PostLoad can trigger an async load which, it seems, can run longer than expected and result in no data set in a migrated asset following a cook.

I was able to mitigate this with the following data validator. It doesn’t actually fix the problem, but emits a warning. In our case, waiting a while before resaving the umaps with the actors eventually let the loads finish and pass the validation without warnings.

#if WITH_EDITOR
EDataValidationResult ALevelSequenceActor::IsDataValid(class FDataValidationContext& Context) const
{
	// Validate that PostLoad has successfully migrated from legacy data
	// If this fails, it likely means that the async load in PostLoad is still pending. Saving again might fix it.
	if (LevelSequence_DEPRECATED.IsValid())
	{
		const FText WarningMessage = FText::Format(NSLOCTEXT("LevelSequenceActor", "IsDataValid_Failed_LevelSequenceActor_Migration", "{0} data migration has not completed."), FText::FromString(GetFullName()));
		Context.AddWarning(WarningMessage);
	}
	if (LevelSequenceAsset == nullptr)
	{
		const FText WarningMessage = FText::Format(NSLOCTEXT("LevelSequenceActor", "IsDataValid_Failed_LevelSequenceActor_NotConfigured", "{0} has no Level Sequence Asset defined."), FText::FromString(GetFullName()));
		Context.AddWarning(WarningMessage);
	}
 
	return Super::IsDataValid(Context);
}
#endif

Hello there,

Have you run a ResavePackages or similar on the project since the upgrade?

Best regards,

Chris

Yes. Although not initially; “random” sequences failing to play led me to discover/realize that we hadn’t done that for umaps yet.

However, this was also causing problems during the resave. When bulk-resaving the umaps with LevelSequenceActors, some of the actors would end up with null LevelSequenceAssets. The warnings in IsDataValid were what finally gave me the signal that the resaves were successful. Basically, I ended up resaving the maps repeatedly until there were no more warnings.

I realize this won’t be a common problem, but given how tricky it was to find the root cause I figured it was worth sharing the validation so there is a signal for others.

(In our case, this was manifesting as a NaN duration in seconds for the sequence, which was messing up some BP logic, and it took a good while to backtrack to this as the root cause.)

That’s interesting. Good to know there is a workaround, even if it’s a bit hit-or-miss to get working.

Thanks for raising it.

It looks like this code and deprecation of LevelSequence was introduced in 5.0, so it’s possible something else has changed that causes this to be an issue. Was this project created prior to 5.0, and is the engine stock 5.6?

Best regards,

Chris