From licensee:
Since we integrated 5.5, we are experiencing a crash in AWorldDataLayers::InitializeDataLayerRuntimeStates() on this line
check(ActiveDataLayerNames.IsEmpty() && LoadedDataLayerNames.IsEmpty());
This happens when we unload a standalone level instance with active runtime data layers and reload it before garbage collection has run. Because the same actor is re-used, ActiveDataLayerNames ends up still containing the activate data layers before the level instance was unloaded, which triggers the crash.
It seems like before 5.5, there was cleanup done when world partition was de-initialized by calling this method:
void AWorldDataLayers::OnDataLayerManagerDeinitialized()
It was removed in CL 37226074, mentioning an crash about replication.
To fix the crash in our project (which is single player), I re-implemented that method, but without the replication code:
void AWorldDataLayers::OnDataLayerManagerDeinitialized()
{
ActiveDataLayerNames.Reset();
LoadedDataLayerNames.Reset();
LocalActiveDataLayerNames.Reset();
LocalLoadedDataLayerNames.Reset();
EffectiveStates.Reset();
}
In a level with world partition streaming enabled, use a runtime data layer (named A) to control the streaming of a standalone level instance. The level instance that is streamed in should also have a runtime data layer (different) that is activated when loaded. In the level blueprint script:
Assertion failed: ActiveDataLayerNames.IsEmpty() && LoadedDataLayerNames.IsEmpty() [\Engine\Source\Runtime\Engine\Private\WorldPartition\DataLayer\WorldDataLayers.cpp] [Line: 165] > UnrealEditor-Engine.dll!AWorldDataLayers::InitializeDataLayerRuntimeStates() Line 165 C++ UnrealEditor-Engine.dll!AWorldDataLayers::OnDataLayerManagerInitialized() Line 1252 C++ UnrealEditor-Engine.dll!UDataLayerManager::Initialize() Line 202 C++ UnrealEditor-Engine.dll!UWorldPartition::Initialize::__l2::<lambda_4>::operator()() Line 747 C++ UnrealEditor-Engine.dll!UWorldPartition::Initialize(UWorld * InWorld, const UE::Math::TTransform<double> & InTransform) Line 791 C++ UnrealEditor-Engine.dll!UWorldPartitionSubsystem::OnLevelBeginMakingVisible(UWorld * InWorld, const ULevelStreaming * InStreamingLevel, ULevel * InLoadedLevel) Line 715 C++ [Inline Frame] UnrealEditor-Engine.dll!Invoke(void(UWorldPartitionSubsystem::*)(UWorld *, const ULevelStreaming *, ULevel *)) Line 66 C++ [Inline Frame] UnrealEditor-Engine.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(void(UWorldPartitionSubsystem::*)(UWorld *, const ULevelStreaming *, ULevel *) &) Line 320 C++ UnrealEditor-Engine.dll!TBaseUObjectMethodDelegateInstance<0,UWorldPartitionSubsystem,void __cdecl(UWorld *,ULevelStreaming const *,ULevel *),FDefaultDelegateUserPolicy>::ExecuteIfSafe(UWorld * <Params_0>, const ULevelStreaming * <Params_1>, ULevel * <Params_2>) Line 689 C++ [Inline Frame] UnrealEditor-Engine.dll!TMulticastDelegateBase<FDefaultDelegateUserPolicy>::Broadcast(UWorld *) Line 258 C++ UnrealEditor-Engine.dll!TMulticastDelegate<void __cdecl(UWorld *,ULevelStreaming const *,ULevel *),FDefaultDelegateUserPolicy>::Broadcast(UWorld * <Params_0>, const ULevelStreaming * <Params_1>, ULevel * <Params_2>) Line 1080 C++ UnrealEditor-Engine.dll!UWorld::AddToWorld(ULevel * Level, const UE::Math::TTransform<double> & LevelTransform, bool bConsiderTimeLimit, FNetLevelVisibilityTransactionId TransactionId, ULevelStreaming * InOwningLevelStreaming) Line 3385 C++ UnrealEditor-Engine.dll!ULevelStreaming::UpdateStreamingState(bool & bOutUpdateAgain, bool & bOutRedetermineTarget) Line 1048 C++ [Inline Frame] UnrealEditor-Engine.dll!FStreamingLevelPrivateAccessor::UpdateStreamingState(ULevelStreaming *) Line 794 C++ UnrealEditor-Engine.dll!UWorld::UpdateLevelStreaming() Line 4667 C++ UnrealEditor-Engine.dll!UGameViewportClient::Draw(FViewport * InViewport, FCanvas * SceneCanvas) Line 1777 C++ UnrealEditor-Engine.dll!FViewport::Draw(bool bShouldPresent) Line 1807 C++ UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2408 C++ UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 533 C++ UnrealEditor.exe!FEngineLoop::Tick() Line 5913 C++ [Inline Frame] UnrealEditor.exe!EngineTick() Line 60 C++ UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 187 C++ UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 267 C++ UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 335 C++ [Inline Frame] UnrealEditor.exe!invoke_main() Line 102 C++ UnrealEditor.exe!__scrt_common_main_seh() Line 288 C++
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-254296 in the post.