The crash occurs when native child class used in the ChildActorComponent has been changed and new native components have been added. To reproduce that I have created two C++ actors and one of those contains a ChildActorComponent:
ParentActor.h
UCLASS()
class TEST_API AParentActor : public AActor
{
GENERATED_BODY()
public:
AParentActor();
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Instanced, Category = Test)
class UChildActorComponent* ChildActorComponent;
};
ParentActor.cpp
AParentActor::AParentActor()
{
ChildActorComponent = CreateDefaultSubobject<UChildActorComponent>(TEXT("ChildActorComponent"));
ChildActorComponent->SetupAttachment(GetRootComponent());
}
ChildActor.h
UCLASS()
class TEST_API AChildActor : public AActor
{
GENERATED_BODY()
public:
AChildActor();
};
ChildActor.cpp
AChildActor::AChildActor()
{
}
Then I have created two blueprints for those actors and assigned ChildActor blueprint class as a class of Parent’s ChildActorComponent. ChildActorComponent creates and set its ChildActorTemplate.
After closing the editor I have added a new component to the child class:
ChildActor.h
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Collision)
UCapsuleComponent* CollisionComponent;
ChildActor.cpp
AChildActor::AChildActor()
{
CollisionComponent= CreateDefaultSubobject<UCapsuleComponent>(TEXT("CollisionComponent"));
if (CollisionComponent)
{
SetRootComponent(CollisionComponent);
}
}
After that change the editor is crashing all the time on loading of the parent blueprint (when I try to open that blueprint for editing) failing to find an Outer for that new component.
checkf(SubobjectOuter, TEXT("No corresponding destination object found for '%s' while attempting to instance component '%s'"), *SourceSubobject->GetOuter()->GetFullName(), *SourceSubobject->GetFullName());
Here is a call stack:
UE4Editor-CoreUObject.dll!FObjectInstancingGraph::GetInstancedSubobject(UObject * SourceSubobject, UObject * CurrentValue, UObject * CurrentObject, bool bDoNotCreateNewInstance, bool bAllowSelfReference) Line 181 C++
UE4Editor-CoreUObject.dll!FObjectInstancingGraph::InstancePropertyValue(UObject * ComponentTemplate, UObject * CurrentValue, UObject * Owner, bool bIsTransient, bool bCausesInstancing, bool bAllowSelfReference) Line 280 C++
UE4Editor-CoreUObject.dll!UObjectPropertyBase::InstanceSubobjects(void * Data, const void * DefaultData, UObject * Owner, FObjectInstancingGraph * InstanceGraph) Line 34 C++
UE4Editor-CoreUObject.dll!UStruct::InstanceSubobjectTemplates(void * Data, const void * DefaultData, UStruct * DefaultStruct, UObject * Owner, FObjectInstancingGraph * InstanceGraph) Line 1456 C++
UE4Editor-CoreUObject.dll!FObjectInitializer::InstanceSubobjects(UClass * Class, bool bNeedInstancing, bool bNeedSubobjectInstancing) Line 2942 C++
UE4Editor-CoreUObject.dll!FObjectInitializer::PostConstructInit() Line 2826 C++
UE4Editor-CoreUObject.dll!FObjectInitializer::~FObjectInitializer() Line 2684 C++
UE4Editor-CoreUObject.dll!StaticConstructObject_Internal(UClass * InClass, UObject * InOuter, FName InName, EObjectFlags InFlags, EInternalObjectFlags InternalSetFlags, UObject * InTemplate, bool bCopyTransientsFromClassDefaults, FObjectInstancingGraph * InInstanceGraph, bool bAssumeTemplateIsArchetype) Line 3212 C++
UE4Editor-Engine.dll!NewObject(UObject * Outer, UClass * Class, FName Name, EObjectFlags Flags, UObject * Template, bool bCopyTransientsFromClassDefaults, FObjectInstancingGraph * InInstanceGraph) Line 1227 C++
UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FTransform * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 405 C++
UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FVector * Location, const FRotator * Rotation, const FActorSpawnParameters & SpawnParameters) Line 271 C++
UE4Editor-Engine.dll!UChildActorComponent::CreateChildActor() Line 482 C++
UE4Editor-Engine.dll!UActorComponent::ExecuteRegisterEvents() Line 1179 C++
UE4Editor-Engine.dll!UActorComponent::RegisterComponentWithWorld(UWorld * InWorld) Line 912 C++
UE4Editor-Engine.dll!AActor::IncrementalRegisterComponents(int NumComponentsToRegister) Line 4004 C++
UE4Editor-Engine.dll!AActor::RegisterAllComponents() Line 3940 C++
UE4Editor-Engine.dll!AActor::PostSpawnInitialize(const FTransform & UserSpawnTransform, AActor * InOwner, APawn * InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction) Line 2728 C++
UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FTransform * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 438 C++
UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FVector * Location, const FRotator * Rotation, const FActorSpawnParameters & SpawnParameters) Line 271 C++
UE4Editor-Kismet.dll!FBlueprintEditor::UpdatePreviewActor(UBlueprint * InBlueprint, bool bInForceFullUpdate) Line 8062 C++
UE4Editor-Kismet.dll!FBlueprintEditor::Tick(float DeltaTime) Line 7028 C++
UE4Editor-UnrealEd.dll!FTickableEditorObject::TickObjects(float DeltaSeconds) Line 17 C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1195 C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 371 C++
UE4Editor.exe!FEngineLoop::Tick() Line 2880 C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 152 C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191 C++
If parent blueprint has been saved in the level then the level will also crash. It will not happen if ChildActorComponent of the parent uses a C++ class (ChildActor) instead of a blueprint one (based on ChildActor).
There are ways to load that object again:
- By reverting a change that added a new component, opening parent blueprint and set a class for ChildActorComponent to None, reapplying code change and selecting blueprint class again
- Or by turning off ChildActorTemplate functionality
Please let me know if those steps work for you in order to reproduce the issue.