Description

This crash can be fixed by adding a couple of || IsRunningGame() like it is done here:

   FGenerateStreamingContext Context = FGenerateStreamingContext()

       .SetLevelPackagesToGenerate((bIsPIE || IsRunningGame()) ? &OutGeneratedLevelStreamingPackageNames : nullptr);

We have fixed it that way:

void UWorldPartition::ShutdownEditorGameWorld()

{

   // No check here since CancelPIE can be called after PrePIEEnded

StreamingPolicy) in UWorldPartition::GenerateContainerStreaming() if it was not GC yet

   if (bIsPIE || IsRunningGame())

   {

and

bool UWorldPartition::GenerateContainerStreaming(const FGenerateStreamingParams& InParams, FGenerateStreamingContext& InContext)

[...]

       StreamingPolicy = NewObject<UWorldPartitionStreamingPolicy>(const_cast<UWorldPartition*>(this), WorldPartitionStreamingPolicyClass.Get(), NAME_None, (bIsPIE || IsRunningGame()) ? RF_Transient : RF_NoFlags);

Steps to Reproduce
  • Have a level instance (standalone) with world partition inside
  • Start editor with -game
  • Get the level instance to be streamed in, UWorldPartition::GenerateContainerStreaming() gets called and initializes StreamingPolicy
  • Stream out that level instance, UWorldPartition::ShutdownEditorGameWorld() gets called but nothing is executed because bIsPIE is false; FlushStreaming() should have been called
  • Get the level instance to be streamed in again, between two garbage collects: UWorldPartition::GenerateContainerStreaming() gets called again but asserts because StreamingPolicy is not nullptr
Callstack

> UnrealEditor-Engine.dll!UWorldPartition::GenerateContainerStreaming::__l2::<lambda_4>::operator()(const UActorDescContainerInstance * InActorDescContainerInstance) Line 2006 C++
UnrealEditor-Engine.dll!UWorldPartition::GenerateContainerStreaming(const UWorldPartition::FGenerateStreamingParams & InParams, UWorldPartition::FGenerateStreamingContext & InContext) Line 2054 C++
UnrealEditor-Engine.dll!UWorldPartition::GenerateStreaming(const UWorldPartition::FGenerateStreamingParams & InParams, UWorldPartition::FGenerateStreamingContext & InContext) Line 1938 C++
UnrealEditor-Engine.dll!UWorldPartition::PrepareEditorGameWorld() Line 487 C++
UnrealEditor-Engine.dll!UWorldPartition::Initialize(UWorld * InWorld, const UE::Math::TTransform<double> & InTransform) Line 872 C++
UnrealEditor-Engine.dll!UWorldPartitionSubsystem::OnLevelBeginMakingVisible(UWorld * InWorld, const ULevelStreaming * InStreamingLevel, ULevel * InLoadedLevel) Line 707 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 3365 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 4647 C++
UnrealEditor-Engine.dll!UGameViewportClient::Draw(FViewport * InViewport, FCanvas * SceneCanvas) Line 1777 C++
UnrealEditor-Engine.dll!FViewport::Draw(bool bShouldPresent) Line 1807 C++
UnrealEditor-Engine.dll!UGameEngine::RedrawViewports(bool bShouldPresent) Line 777 C++
UnrealEditor-Engine.dll!UGameEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1947 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5906 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++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-240282 in the post.

0
Login to Vote

Unresolved
CreatedJan 27, 2025
UpdatedJan 28, 2025
View Jira Issue