Yo whatup, Inconceivable. Nice name btw, I’m surprised that was available, given that it can be a synonym for “unreal” in the right context. Nice.
Anyway, say you have a TArray of some stuff. Like this:
TArray<Stuff> things;
to save it as an asset in a package, I think you do this:
FString packageName = TEXT("/Game/DecalSet/KavalierClay");
UPackage* package = CreatePackage(*packageName);
FString packageFileName = FPackageName::LongPackageNameToFilename(packageName, FPackageName::GetAssetPackageExtension());
UPackage::SavePackage(package, things, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, *packageFileName, GError, nullptr, true, true, SAVE_NoError);
And then to load it, in BeginPlay or wherever, you do this:
FString packageName = TEXT("/Game/DecalSet/KavalierClay");
UPackage* package = CreatePackage(*packageName);
FString packageFileName = FPackageName::LongPackageNameToFilename(*packageName, FPackageName::GetAssetPackageExtension());
FString assetName = "HiphopOpotamusMyLyricsAreBottomless";
things = LoadObject<TArray<Stuff>>(package, *assetName, *packageFileName, EObjectFlags::RF_Public, nullptr);