Description

Adding a component to a subclass after the component was declared in the parent class results in the component not being editable if a Blueprint had already been created using the subclass. This only occurs when a Hot Reload takes place after the code is added to the subclass' source code.

This was found to be happening in Main up to CL 2408355. After this CL in Main, hot reloading after adding a component no longer worked (see [Link Removed]).

WORKAROUND:
Close the Editor and re-open the project in the Editor.

Steps to Reproduce
  1. Create a new code project using the First Person template.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new code class derived from Actor. Name the class Pickup.
  5. Close the Editor.
  6. In the header file for the new Pickup class, add the following code:
    public:
    	APickup(const FObjectInitializer& ObjectInitializer);
    
    protected:
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Ball, meta = (AllowPrivateAccess = "true"))
    	USphereComponent* CollisionSphere;
    
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Ball, meta = (AllowPrivateAccess = "true"))
    	UStaticMeshComponent* PickupMesh;
    
  7. In the source file for the new Pickup class, add the following code:
    APickup::APickup(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer)
    {
    	CollisionSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("CollisionSphere"));
    	RootComponent = CollisionSphere;
    }
    
  8. Build the project in Visual Studio.
  9. Open the project in the Editor.
  10. Add a new code class to the project derived from the Pickup class created in step 4. Name this class MyPickup.
  11. Close the Editor.
  12. In the header file for MyPickup, add the following code:
    public:
    	AMyPickup(const FObjectInitializer& ObjectInitializer);
    
  13. In the source code file for MyPickup, add the following code:
    AMyPickup::AMyPickup(const FObjectInitializer& ObjectInitializer)
    	: Super(ObjectInitializer)
    {
    	
    }
    
  14. Build the project in Visual Studio.
  15. Open the project in the Editor.
  16. Create a Blueprint derived from MyPickup.
    • Note that it only contains a sphere collision component.
  17. Leave the Editor open and add the following code to the MyPickup source code file:
    static ConstructorHelpers::FObjectFinder<UStaticMesh> TheMesh(TEXT("/Game/FirstPerson/Meshes/FirstPersonTemplateCube.FirstPersonTemplateCube"));
    
    PickupMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
    PickupMesh->SetStaticMesh(TheMesh.Object);
    PickupMesh->AttachTo(RootComponent);
    
  18. Build the project in Visual Studio to trigger a hot reload.
  19. Open the MyPickup Blueprint in the Editor.

RESULT:
The PickupMesh component has been added to the Blueprint, but it is not editable in the Details panel.

EXPECTED:
The PickupMesh component has been added to the Blueprint and is editable in the Details panel.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Cannot Reproduce
ComponentTools
Affects Versions4.6.14.8
Fix Commit2517610
CreatedJan 29, 2015
ResolvedApr 20, 2015
UpdatedJul 14, 2021
View Jira Issue