Remove any UObject?

As well as I can create any object with something like


UMaterial* UnrealMaterial = NewObject<UMaterial>(Package, *FixedMaterialName, RF_Public); 
FAssetRegistryModule::AssetCreated(UnrealMaterial);

Is there anyway to remove it?

I tried with


findMaterial = FindObject<UMaterial>(ANY_PACKAGE, mname);//works ok
if (findMaterial != NULL)
   findMaterial->ConditionalBeginDestroy();

But without luck :frowning:

Thanks for your help!

You don’t need to do anything explicit to destroy the UObject. Once all pointers to it are nulled, the garbage collector will clean it up.