Hello,
Here is the context :
I am currently working on a plugin to make some custom commands (in blueprints) to ease deployment or post builds processes (something that seems a little like the build xml file that make its apparition in UE 4.13).
Well, my issue is that I want to save/load some custom datas. I don’t want theses datas to be saved in the Content directory, to hide them from the user and not pollute their project with asset that will not be packaged.
So, I want to save these datas in Plugin/MyPlugin/Datas.
My datas are stocked in a UObject*.
With that in mind, I thought custom asset was not I wanted since the factory (FactoryNew), perhaps, will force me to make my asset in the Content directory.
Here is the problem :
So I am using CreatePackage/SavePackage/LoadPackage. But I am encountering some issues.
For datas creation, I do :
package = CreatePackage(nullptr, *absoluteFilePath); // Create the package where I want
ProfileDatas = NewObject<UCCProfileDatas>(package, UCCProfileDatas::StaticClass(), CCProfileDatasSaveDataName); // Create a new object of my datas that will be in the package
package->MarkPackageDirty(); // Mark package dirty to be able to save it
FStringOutputDevice outputDevice; // Will get error message
if (UPackage::SavePackage(package, nullptr, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, *absoluteFilePath, &outputDevice)) // Save the package where I want
Then, to load the datas, I do :
package = LoadPackage(nullptr, *outPackagePath, LOAD_None);
This works. Until I add some datas in my object. I fill a TArray (as a UPROPERTY).
Then I save it, but when I load it again. It crashes here :
LinkerLoad.cpp : line 3586
UObject* Template = UObject::GetArchetypeFromRequiredInfo(LoadClass, ThisParent, Export.ObjectName, Export.ObjectFlags);
check(Template);
With ‘Export.ObjectName = 0x00000017aeada028 “Default__Object”’. I do not know what is this Default__Object.
Any idea ? What I am doing wrong ? Should I use some custom asset to make a correct serialization ?