Hello everybody,
I want to create a class with a specific UDestructibleMesh to spawn and fracture from C++ code.
I’ve imported a mesh created a Destructible Mesh using the UE4 editor and named it Chunck_DM.
I’ve created a C++ class with a Property TSubclassOf<class UDestructibleMesh> called MainDestructibleMesh with UPROPERTY EditAnywhere:
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Destrcutable)
TSubclassOf<class UDestructibleMesh> MainDestructibleMesh;
I can see and change the MainDestructibleMesh property in the editor but I can’t assign it my custom created mesh. it only allow me to select DestructibleMesh.
isn’t my destructible mesh a subclass of UDestructibleMesh?
even when I change the TSubclassof’s class to UObject, I can’t assign my DestructibeMesh…
what am I doing wrong and why?
full class code:
#pragma once
#include "GameFramework/Actor.h"
#include "DestructableItem.generated.h"
UCLASS()
class DESTRUCTION_API ADestructableItem : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Destrcutable)
TSubclassOf<class UDestructibleMesh> MainDestructibleMesh;
// Sets default values for this actor's properties
ADestructableItem();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};