I’m importing and writing UStaticMesh files to uassets in the editor, which works fine at first glance - the files can be placed in maps and blueprints, can be tweaked with the StaticMesh editor and can even be exported to FBX.
However, when the time comes to cook them, suddenly, they’re all throwing up “Display: No exports found (or all exports are editor-only) for paintalpha_test_singlemesh_2. Package will not be saved.” errors and the like, and I can’t for the life of me figure out why.
They’re not specifically set as editor only as far as I can see, and the way they get saved should make them exactly the same as every other file that UE does want to package.
UPackage* Package = CreatePackage(NULL, *NewPackageName);
UStaticMesh* NewAsset = CreateStaticMesh(rawMesh, meshMaterials, Package, FName(*MeshName));
FAssetRegistryModule::AssetCreated(NewAsset);
NewAsset->PostEditChange();
NewAsset->MarkPackageDirty();
FString PackageFileName = FPackageName::LongPackageNameToFilename(NewPackageName, FPackageName::GetAssetPackageExtension());
if (UPackage::SavePackage(Package, NewAsset, RF_Public | RF_Standalone, *PackageFileName, GError, nullptr, false, true, SAVE_NoError))
{
Package->PostEditChange();
Package->MarkAsFullyLoaded();
}
Possibly related is that you can delete the saved uasset files in UE in the session you’ve saved them in, but if you try to delete them the next time you run UE, it crashes, unless you’ve opened them in the StaticMesh Editor again, then it wants to delete them without complaints.
Edit: did some more digging, and found even weirder things. If you rightclick-re-save the uasset files in the unreal editor, it turns them into 1K empty files for no apparent reason that I can see. Mesh is still loaded in memory, clicking on the file still opens it in the Static Mesh Editor, just… everything in the file is gone, and will mess up the data next time you restart the editor. Why?