I have an editor only actor that can be added to a level. This actor has a UProceduralMeshComponent inside it. When the actor is later selected and deleted the ProceduralMeshComponent is still showing up in the memory report using “memreport -full” and the mb RAM usage never returns back to before I added the actor
The procedural mesh component is being created using:
MyProcMesh = CreateEditorOnlyDefaultSubobject<UProceduralMeshComponent>(TEXT("MyProcMesh")); RootComponent = MyProcMesh;
I have tried:
- Setting the RootComponent to nullptr
- MyProcMesh->DestroyComponent inside the BeginDestroy() of the actor
- Using a USceneComponent as the RootComponent and using SetupAttachment() to attach the MyProcMesh to the scene component.
The MyProcMesh UProceduralMeshComponent is added to the actor and I can use it but when it comes to deleting/removing the actor the UProceduralMeshComponent is still showing in the memreport.
I did a memreport before adding the actor and there are no ProceduralMeshComponents but after adding three actors and deleting them there are then three ProceduralMeshComponents left behind.
I also left it for 10 minutes for the garbage collector to do its checking but it never seems to clear them out.
I must be missing something regarding the dereferencing the UProceduralMeshComponent but don’t what to do.
Any help would be appreciated.