SavePackage In Packaged Builds

So I’ve run into an issue recently and figured I would reach out to see if anyone else has had a similar issue or any tips.

I’m working on an RPG project where we are mesh merging numerous meshes into a single mesh. This gives pretty substantial performance gains with a lot of players on the screen, but the merging process causes some noticeable stutters.

I built a caching system using the SavePackage/LoadPackage system which would create a package for merged characters after they were merged and saved that into your saved directory so once you had merged a character once it could load them from disk on future loads to minimize the impact. This system works fine in the editor build.

However once I package I run into issues. SavePackage is included as part of CoreUObject but at the very top of the code it has this line:

if (FPlatformProperties::HasEditorOnlyData())

Which basically early outs it every time and never saves. I tried to work around this by creating a duplicate function that we call which would then modify bits until we got it working but it always crashes when serializing.

This line in savepackage.cpp:

check(Linker->Tell() == OffsetAfterPackageFileSummary);

Directs us to this routine in PackageFileSummary.cpp:

FArchive& operator<<( FArchive& Ar, FPackageFileSummary& Sum )

Which crashes on this line:

Ar << Sum.Tag;

Due to calling LinkerSave.cpp’s Serialize function and crashing on line 236:

Saver->Serialize( V, Length );

Has anyone else tried using savePackage in clients? Or have any other suggestions? It seems like savePackage should work since it has a CoreUObject version (as well as an editor version), but early outs without executing anycode.

Sorry for the necro, but have you ever found a solution for this?

I too am trying to generate a mesh during runtime and save it to disk, however I’ve encountered the same obstacle.

I thought of using LinkerSave directly, but it doesn’t seem to be possible to include it (or maybe I don’t know how to include it properly).

Now I’m wondering if it would be worth it to try to replicate the implementation of LinkerSave/FArchiveUObject separately or is there a ready made solution from the engine that I could still use?

Thanks in advance!