How to save thumbnail for new asset?

I created a new asset and saved the package like this

GEditor->SavePackage(Package, NULL, RF_Standalone, *FileName, GWarn);

but, the package thumbnail is not saved.
when restart unreal editor, the package thumbnail image goes back to default image(icon?).

128556-thumbnaila.jpg

(This is Animation Sequence Asset)

I found the function Package::SaveThumbnails(UPackage* InOuter, FlinkerSave* Linker).
What is FLinkerSave?
Should I use this function?

please help

thank you.

Try using the function like this:

FString desitinationPath("path/to/save.uasset");
UPackage::SavePackage(yourPackage, nullptr, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, *destinationPath);

Worked for me, the path must end in .uasset and be absolute, not relative!

For anyone else coming across this…

You need to call:

ThumbnailTools::GenerateThumbnailForObjectToSaveToDisk(MyUObject)

before calling:

GEditor->SavePackage()

Don’t forget to include “ObjectTools.h”.

Thanks brudda, it works)