Description

An editor crash can be observed when copy-pasting an actor with an actor component with an instanced object property when set to a non-default value.

Detailed steps to reproduce are provided below.

The crash seems to be caused by a check in FObjectInstancingGraph::GetInstancedSubobject at line 210:
checkf(SubobjectOuter && SubobjectOuter != INVALID_OBJECT, TEXT("No corresponding destination object found for '%s' while attempting to instance subobject '%s'"), *SourceSubobject->GetOuter()>GetFullName(), *SourceSubobject>GetFullName());

This behaviour seems similar to that described in this knowledge base article:
https://udn.unrealengine.com/s/article/EditInlineNew-Instanced-Components

 

Steps to Reproduce

Use the following code in the header:
UCLASS(BlueprintType, Abstract, EditInlineNew)
class UPL_TestSubobjectBase : public UObject
{
GENERATED_BODY()
};

UCLASS()
class UPL_TestSubobjectOne : public UPL_TestSubobjectBase
{
GENERATED_BODY()

public:

UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 One

{ 1 }

;
};

UCLASS()
class UPL_TestSubobjectTwo : public UPL_TestSubobjectBase
{
GENERATED_BODY()

public:

UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Two

{ 2 }

;
};

UCLASS(BlueprintType, Meta = (BlueprintSpawnableComponent))
class UPL_TestComponent : public UActorComponent
{
GENERATED_BODY()

public:

UPL_TestComponent(const FObjectInitializer& ObjectInitializer);

UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, NoClear)
TObjectPtr<UPL_TestSubobjectBase> TestSubobject

{ nullptr }

;
};

Use the following code in the CPP:
UPL_TestComponent::UPL_TestComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
TestSubobject = CreateDefaultSubobject<UPL_TestSubobjectOne>(TEXT("TestSubobjectOne"));
}

Do the following:

  • Place an actor in a level with a UPL_TestComponent
  • Change the instanced property value from the default of UPL_TestSubobjectOne to UPL_TestSubobjectTwo
  • Copy and paste the actor in the world outliner
  • Observe an editor crash

Have Comments or More Details?

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

0
Login to Vote

Backlogged
ComponentUE - Framework
Affects Versions5.35.3.2
CreatedFeb 2, 2024
UpdatedMar 21, 2024