Description

If an Actor with a CameraComponent is set to replicate, ending a PIE session with 2 players will result in an ensure

Steps to Reproduce

1. Create a new blank C++ project
2. Add a new C++ class based off Actor named MyActor
3. On Line 23 of MyActor.h, add the following lines of code:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
	class UCameraComponent* Camera; 

4. On Line 12 of MyActor.cpp add the following lines of code:

	Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
	Camera->SetIsReplicated(true);
	bReplicates = true;

5. Compile the project and drag an instance of the MyActor class into the viewport
6. Change the PIE settings to have 2 players and press Play
7. Press Esc to end the PIE session
Result: The editor freezes for a short time and an ensure appears in the Output Log
Expected: The PIE session should end swiftly.

Callstack
 Ensure condition failed: !bRegistered || AttachParent->AttachChildren.Contains(this) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\Engine\Private\Components\SceneComponent.cpp] [Line: 1393]
Attempt to detach SceneComponent 'StaticMeshComponent_6' owned by 'MyClass_3' from AttachParent 'CameraComponent' while not attached.
Stack: 
UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:175]
UE4Editor-Core.dll!FDebug::EnsureFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\misc\outputdevice.cpp:276]
UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\misc\outputdevice.cpp:385]
UE4Editor-Engine.dll!USceneComponent::DetachFromParent() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\components\scenecomponent.cpp:1393]
UE4Editor-Engine.dll!UCameraComponent::OnUnregister() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\camera\cameracomponent.cpp:109]
UE4Editor-Engine.dll!UActorComponent::ExecuteUnregisterEvents() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\components\actorcomponent.cpp:1079]
UE4Editor-Engine.dll!UActorComponent::UnregisterComponent() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\components\actorcomponent.cpp:894]
UE4Editor-Engine.dll!AActor::UnregisterAllComponents() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\actor.cpp:3580]
UE4Editor-Engine.dll!ULevel::ClearLevelComponents() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\level.cpp:616]
UE4Editor-Engine.dll!UWorld::ClearWorldComponents() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\world.cpp:1261]
UE4Editor-Engine.dll!UWorld::CleanupWorld() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\world.cpp:3148]
UE4Editor-UnrealEd.dll!UEditorEngine::TeardownPlaySession() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\playlevel.cpp:600]
UE4Editor-UnrealEd.dll!UEditorEngine::EndPlayMap() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\playlevel.cpp:218]
UE4Editor-UnrealEd.dll!UEditorEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\editorengine.cpp:978]
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\unrealedengine.cpp:361]
UE4Editor.exe!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launchengineloop.cpp:2427]
UE4Editor.exe!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor.exe!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor.exe!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
UE4Editor.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-23441 in the post.

0
Login to Vote

Cannot Reproduce
ComponentNetworking
Affects Versions4.9.24.10
CreatedNov 17, 2015
ResolvedApr 26, 2016
UpdatedJul 14, 2021