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