I have a bit of complex situation (well, complex for me).
I have a main class that defines its construction script in the blueprint. Here, it also spawn a dynamic material.
So far so good.
The issue arises with the child blueprint class of this class. This child needs to copy its mesh from another class’s mesh and then call the parent construction script.
Parent class header
AInteractableBase : public AActor, public IInteractInterface
{
GENERATED_BODY()
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* EmissiveMesh;
UPROPERTY(EditInstanceOnly, BlueprintReadWrite)
UMaterialInstanceDynamic* DynamicEmissiveMaterial;
....
Parent class cpp
AInteractableBase::AInteractableBase()
{
PrimaryActorTick.bCanEverTick = true;
EmissiveMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Base Mesh"));
RootComponent = EmissiveMesh;
}
Blueprint construction script of parent class
Ok so far this stuff works. Now the child class (BP_BasePickup) carries a Class Reference to another object (AUsableObjects), and I need to get the PickupMesh of this class and assign it to Emissive Mesh in BP_BasePickup.
class AUsableObjects : public AActor
{
GENERATED_BODY()
protected:
UPROPERTY(EditInstanceOnly, BlueprintReadWrite)
UStaticMeshComponent* PickupMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
USkeletalMeshComponent* ObjectMesh;
....
AUsableObjects::AUsableObjects()
{
ObjectMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Object Mesh"));
PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Pickup Mesh"));
RootComponent = ObjectMesh;
PickupMesh->SetupAttachment(RootComponent);
}
And here’s where I’m ultimately stuck
BP_BasePickup construction script