Create/Save asset from code

Hello there,

I have a UAnimMontage that I create procedurally from code, but can just be anything really.
I cannot see a way to save it as an asset usable from the content browser.

All I can do is to have a fake empty asset somewhere, and use
UEditorAssetLibrary::DuplicateAsset(Source->GetFullName(), AssetPathFull.c_str());

Which is very poor, I can’t see a way for UEditorAssetLibrary to save an asset created from code.

I had partial success, ie total failure, with

UPackage::SavePackage

Everything I tried generates a bogus entry (.uasset 1k bytes on disk entry) that crashes the editor the next time I try to access it. It’s perfectly fine in memory but on disk it looks just like an empty reference or something.

Dado.