From licensee:

We've recently encountered an issue where BeginPlay was called on an Actor while the World is being torn down. This seems to stem from flushing level streaming while it has levels that need to be made visible.

Steps to Reproduce

To repro this, you need a world with a lot of level instances and you could add "ensure(!GetWorld()->bIsTearingDown)" to BeginPlay of some of the actors to help catch it:

  • Start PIE as Client. (Should be able to repro it in Standalone but I haven't tried it yet)
  • Run/fly around to cause level streaming to update.
  • End PIE or close the editor, without waiting in one place for too long so level streaming hasn't fully caught up yet.
UnrealEditor-Engine.dll!AActor::DispatchBeginPlay(bool bFromLevelStreaming) Line 4115	C++
UnrealEditor-Engine.dll!ULevel::RouteActorInitialize(int NumActorsToProcess) Line 3382	C++
UnrealEditor-Engine.dll!UWorld::AddToWorld(ULevel * Level, const UE::Math::TTransform<double> & LevelTransform, bool bConsiderTimeLimit, FNetLevelVisibilityTransactionId TransactionId, ULevelStreaming * OwningLevelStreaming) Line 3018	C++
UnrealEditor-Engine.dll!ULevelStreaming::UpdateStreamingState(bool & bOutUpdateAgain, bool & bOutRedetermineTarget) Line 923	C++
[Inline Frame] UnrealEditor-Engine.dll!FStreamingLevelPrivateAccessor::UpdateStreamingState(ULevelStreaming *) Line 749	C++
UnrealEditor-Engine.dll!UWorld::UpdateLevelStreaming() Line 3897	C++
[Inline Frame] UnrealEditor-Engine.dll!UWorld::FlushLevelStreaming::__l2::<lambda_b56fe6bcc26432b93860da478b828a4f>::operator()() Line 4150	C++
UnrealEditor-Engine.dll!UWorld::FlushLevelStreaming(EFlushLevelStreamingType FlushType) Line 4166	C++
UnrealEditor-UnrealEd.dll!UEditorEngine::TeardownPlaySession(FWorldContext & PieWorldContext) Line 811	C++
UnrealEditor-UnrealEd.dll!UEditorEngine::EndPlayMap() Line 343	C++

Have Comments or More Details?

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

Login to Vote

By Design
CreatedOct 16, 2023
ResolvedOct 17, 2023
UpdatedNov 3, 2023
View Jira Issue