C++ Derived Blueprint: Inherited Component not editable

I have an abstract actor class from which all my interactable objects inherit from.
In there I have a widget component, which I need to edit in Child Actors (Mostly BP Actors). However, this component cannot be edited in the children. I have been searching for a few days now and tried all possible combinations of UPROPERTY specifiers. My Current Code:

Header File:

UCLASS(Abstract, Blueprintable, BlueprintType)
class GAME_API AInteractable : public AActor
{
	GENERATED_BODY()
	
public:	

	/** Default constructor for AInteractable */
	AInteractable();

	/** Constructor for AInteractable that takes an ObjectInitializer for backward compatibility */
	AInteractable(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

	UPROPERTY(BlueprintReadWrite, NonTransactional, meta=(Category="Default", OverrideNativeName="InteractionWidgetComponent"))
	UWidgetComponent* InteractionWidgetComponent;

	UPROPERTY(BlueprintReadWrite, NonTransactional, meta=(Category="Default", OverrideNativeName="DefaultSceneRoot"))
	USceneComponent* DefaultSceneRoot;

private:

	/** Called from the constructor to initialize the class to its default settings */
	virtual void InitializeInteractable();

	/* STUFF */

}

C++ File:

AInteractable::AInteractable() : Super()
{
	InitializeInteractable();
}

AInteractable::AInteractable(const FObjectInitializer& ObjectInitializer)  : Super(ObjectInitializer)
{
	InitializeInteractable();
}

void AInteractable::InitializeInteractable()
{
	DefaultSceneRoot = CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot"));
	InteractionWidgetComponent = CreateDefaultSubobject<UWidgetComponent>(TEXT("InteractionWidgetComponent"));

	RootComponent = DefaultSceneRoot;
	DefaultSceneRoot->CreationMethod = EComponentCreationMethod::Native;

	InteractionWidgetComponent->CreationMethod = EComponentCreationMethod::Native;
	InteractionWidgetComponent->AttachToComponent(DefaultSceneRoot, FAttachmentTransformRules::KeepRelativeTransform );
	InteractionWidgetComponent->SetWidgetSpace( EWidgetSpace::Screen );
	InteractionWidgetComponent->SetDrawAtDesiredSize(true);

	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}

My current Version is based on a recreated BP Actor using Bluepring Nativizing.

Problem:

Sorry if I made some obvious mistake I’m pretty new to C++ programming in UE

I too have read that this Behavior is intended but I cannot belive that this ā€œnormalā€ behavior for BP is not even possible for C++ Classes

You need one of the ā€œEditā€¦ā€ specifiers. The BlueprintReadWrite only makes properties usable for programming in Blueprint (i.e. they can appear as nodes in event graphs) but it won’t make them show up in the detail panels. So if you want your widget to have a detail panel in the archetype you would probably want:

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UWidgetComponent* InteractionWidgetComponent;

Also you don’t need to add a default scene root yourself, that’s just a place-holder component that will be auto-generated by Unreal when there are no other components in the actor.

1 Like

Yeah thanks. I actually tried this before but I had to re reparent my existing BP Actors, so the changes take effect. I can’t belive I haven’t tried this earlier.