Deleting asset break the content browser

Hi,

I am trying to unload custom asset after I updated it during a build process.

This is the step I do:

  • read metadata generated by a tool (not in unreal)
  • get the custom asset by path and load it if needed (FAssetData::GetAsset)
  • update the info I need to update
  • MarkPendingKill if the asset wasn’t loaded before (FAssetData::IsAssetLoaded before I get)
  • play the game in editor

The result is a “failed to load asset” pop up if I try to open it from the content browser.

255636-error-message.png

I try many ways to unload my data but I’m stuck.

Thanks!


EDIT

I finally found a way:

    TArray<UPackage*> Packages;
    Packages.Add(Asset->GetOutermost());
    PackageTools::UnloadPackages(Packages);
1 Like