UDestructibleMesh not recognised

Hi,

I’m currently trying to use UDestructibleMesh in my code, however whenever I run it it doesn’t compile because it doesn’t recognise UDestructibleMesh as a class even though I have the following header files in my cpp file (they need to be there or I get lots of errors).
#include "Engine/DestructibleMesh.h" #include "PhysicsEngine/DestructibleActor.h"

Here is a snippet of my code I’m trying to use and would appreciate advice on firstly how to stop it giving me an error and secondly how to make use of the code to generate a destructible mesh at runtime.

//cpp file
float X3 = rand() % 2928 - 2043.391357;
		float Y3 = rand() % 3206 - 1623.111572;
		
		FVector Location2 = FVector(X3, Y3, 840.00000);
		ADestructibleActor* NewDMCube = GetWorld()->SpawnActor<ADestructibleActor>(Location, FRotator::ZeroRotator);
		
		NewDMCube->GetDestructibleComponent();
		NewCube->GetStaticMeshComponent()->SetMobility(EComponentMobility::Movable);
		NewCube->GetStaticMeshComponent()->SetStaticMesh(MyDMesh);

//header file
UPROPERTY()
		UDestructibleMesh* MyDMesh; //(doesn't actually bring up an error till it's compiled

I am quite new to Unreal so I’d appreciate a degree of patience if I have follow up questions that sound naive or wrong.

Thanks

Hey!

I had a same problem and I did fix it by adding this to my .h file

#include "Components/DestructibleComponent.h"

and this to my .cpp file

#include "Engine/DestructibleMesh.h"