Hi, I’ve been through several posts on this issue that suggested VisibleAnywhere and deleting cache (.vs, Binaries, Intermediate, Saved, *.sln) and regenerating the project files. I’ve [tried][1] [those][2] [things][3].
Challenge: I’d like to use a Blueprint class to configure settings for my C++ class, but I can’t set the StaticMesh’s in the Editor. This seemed to be a common pattern, but maybe there’s something new I’m missing.
// .h
UCLASS()
class TESTDESTRUCTION_API ASplodyMesh : public AActor
{
GENERATED_BODY()
public:
// ---------------------------------------------------------- Unreal Actor
ASplodyMesh();
protected:
virtual void BeginPlay() override;
public:
virtual void Tick(float DeltaTime) override;
// WORKS - can set to a DestructibleMesh asset in Blueprint
UPROPERTY(VisibleAnywhere)
class UDestructibleComponent* Destructible;
// WORKS
UPROPERTY(VisibleAnywhere)
class UMaterialInterface* DestructibleOuterMaterial;
// DOESNT WORK - shows "none" can't edit
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
class UStaticMeshComponent* TargetMesh;
// WORKS can set mesh but it's not a component
UPROPERTY(VisibleAnywhere)
class UStaticMesh* TargetMesh2;
...
// .cpp
ASplodyMesh::ASplodyMesh()
{
PrimaryActorTick.bCanEverTick = true;
RestoredMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("RestoredMesh"));
RestoredMesh->SetupAttachment(GetRootComponent());
TargetMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TargetMesh"));
TargetMesh->SetupAttachment(GetRootComponent());
Destructible = CreateDefaultSubobject<UDestructibleComponent>(TEXT("Destructible"));
Destructible->SetupAttachment(GetRootComponent());
}
Here’s how it looks when placed in the scene and similar in the BP editor.
I’ve spent 3 hours on this because it “worked before” but not now. My backup plan is to convert the UPROPERTYs to UStaticMesh*s so they can be saved, then create SubObject UStaticMeshComponent variables and set the meshes from the UPROPERTY’s in BeginPlay,
It seems like there is/was a better way. What am I missing?