Show component in actor including inheriting components


Recently I’ve been trying to create an actor that displays a component in the details panel with some added functionality. The idea is to have an actor from which I can inherit in blueprint, but doesn’t force me to have a specific component implementation. The usual way would be to just add the component in the C++ constructor and be done with it. But I want to be more flexible. It’s supposed to allow me to add any subclass of the specified component, but also show it in the details panel. The code looks as followed:

    UPROPERTY(Category = Color, VisibleAnywhere, BlueprintReadOnly, Instanced, meta = (AllowPrivateAccess = "true"))
    UColoredActorBaseComponent* ColoredActorComponent;

Then, in the construction (not constructor) of the actor, I’m scanning for a component of that class and assign it to the variable:

void AColoredActor::OnConstruction(const FTransform& Transform)

    if (ColoredActorComponent == nullptr || ColoredActorComponent->IsBeingDestroyed())
        UActorComponent* component = FindComponentByClass(UColoredActorBaseComponent::StaticClass());
        ColoredActorComponent = Cast<UColoredActorBaseComponent>(component);

Now I can add any component inheriting from UColoredActorBaseComponent in blueprint and it’s being properly displayed. But there is one issue. Whenever I change anything on the actor, unreal suddenly thinks I’m changing multiple components. I’ve added two screenshots to clearly demonstrate the problem with before -> after, with red indicating the values of the displayed component:

Once again: this happens whenever I change anything on the actor. Strangely enough, deselecting and selecting the actor solves the issue and the values are properly displayed. Changing anything again leads to the issue described above, and I have to deselect and select again etc.
Also important to note: This issue only occurs when the component was added in the blueprint. If I instead add the component to the actor in the world it works as expected. I hope someone has an answer to this, because I feel like this is some sort of bug. Or maybe I’m missing something.



Remove the *Instanced *keyword from UProperty().

Removing Instanced doesn’t seem to solve the issue unfortunately