Hi all. I have strange issue witt save/load using FObject(Reader/Writer). I have simple structure:
UCLASS(Blueprintable)
class USkillFeature : public UObject {
GENERATED_BODY()
public:
USkillFeature() = default;
protected:
UPROPERTY(Transient, VisibleAnywhere)
USkill* Skill = nullptr;
};
Save/Load process is folowing:
//Save
TArray<uint8> InBytes;
FObjectWriter Writer(Obj, InBytes);
...
//load
auto tmp = Cast<UClass>(Obj)->GetDefaultObject();
if (tmp->IsA(USaveInstanced::StaticClass())) {
Obj = DuplicateObject(tmp, tmp->GetPackage());
TArray<uint8> InBytes;
InnerArchive << InBytes;
FObjectReader Reader(Obj, InBytes);
When I load this class I have following exception here:
#if USE_CIRCULAR_DEPENDENCY_LOAD_DEFERRING
if (ULinkerPlaceholderExportObject* PlaceholderVal = Cast<ULinkerPlaceholderExportObject>(ObjectValue))
But I put Transient for that field. It has to be ignored in save/load process. In rare cases when save load works this property is loaded from save file. So seems like Transient do nothing in my case. Debugging haven’t helped yet.
This workaround works, but I don’t like to implement it for any internal object reference in all children
inline void USkillFeature::Serialize(FArchive& Ar) {
Skill = nullptr;
Super::Serialize(Ar);
}
What I’m doing wrong? Thanks!