Description

I think the issue is that in GetInstancedSubobject() (CoreNative.cpp), the following bit of code is not considering that the instanced subobject might be outered to another instanced subobject within a chain that's rooted at a Blueprint class instance (e.g. a nested subobject instance owned by a component subobject instance that's owned by a Blueprint Actor instance):

// Don't seach for the existing subobjects on Blueprint-generated classes. What we'll find is a subobject
// created by the constructor which may not have all of its fields initialized to the correct value (which
// should be coming from a blueprint).
// NOTE: Since this function is called ONLY for Blueprint-generated classes, we may as well delete this 'if'.
if (!SubobjectOuter->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint))
{
	InstancedSubobject = StaticFindObjectFast(NULL, SubobjectOuter, SubobjectName);
}

I think what happens then is that it finds the original instance that was created by CreateDefaultSubobject(), but that one does not include defaults from the generated Blueprint CDO.

Steps to Reproduce

1. Start with the project attached to [Link Removed]
2. Add a C++ class based on Actor (MyActor)
3. Add the following to the class declaration in MyActor.h:

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    UMySceneComponent* MyNativeScene;

4. Add the following to the MyActor constructor in MyActor.cpp:

    MyNativeScene = CreateDefaultSubobject<UMySceneComponent>(TEXT("MyNativeScene"));

5. Compile in Visual C++ and relaunch the editor.
6. Create a new Blueprint class based on MyActor (MyActorBP).
7. Open MyActorBP, select the 'MyNativeScene' component and edit the 'Shape' property on the 'ArmCollider' subobject so that the BoxExtent is 32,32,400.
8. Compile and save the Blueprint.
9. Drag an instance of MyActorBP into the level. Note that the box collision shape doesn't match the new default value entered in Step 7. Also note that in the Details view the "Reset to Default" arrow is visible on the BoxExtent property, even though it wasn't modified on the instance.

Have Comments or More Details?

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

7
Login to Vote

Won't Fix
CreatedJan 19, 2017
ResolvedAug 18, 2021
UpdatedAug 18, 2021