I have the following setup.
An actor InteractableButton, which has its components, meshes, logic and so on created in c++.
I have a BP_InteractableButton which derives InteractableButton and has everything laid out properly in the viewport.
I’m trying to create something like a scoreboard with buttons. My questions is:
How to attach multiple instances of this BP_InteractableButton to my scoreboard actor so I can access the logic inside them (from code) and further edit their layout in the viewport of the bluprint that will derive that scoreboard class.
If I create the buttons (from their c++ class) and attach them to the scoreboard actor they do not show up in the hierarchy of the blueprints that inherits the scoreboard class. (Even if they did I imagine the settings done in the BP about transform meshes and so on will be lost).
AUpgradableStatItemComponent::AUpgradableStatItemComponent()
{
PrimaryActorTick.bCanEverTick = true;
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
SetRootComponent(Mesh);
StatName = CreateDefaultSubobject<UTextRenderComponent>(TEXT("RootBox"));
StatName->SetupAttachment(Mesh);
//StatName->SetupAttachment(this);
for (int i = 0; i < TotalLevels; i++) {
AInteractableButton * button = CreateDefaultSubobject<AInteractableButton>(FName(*(FString("Button") + FString::FromInt(i))));
button->AttachToComponent(Mesh, FAttachmentTransformRules::KeepRelativeTransform);
LevelBoxes.Add(button);;
}
// ...
}