sinbad / SPUD

Steve's Persistent Unreal Data library
MIT License
300 stars 44 forks source link

Set the Outer for newly constructed nested UObjects #32

Closed cyphusx closed 2 years ago

cyphusx commented 2 years ago

During testing, I noticed that restored nested UObjects were being created with their Outer set to the UClass of their containing UObject. Digging deeper, I found that this was being caused by the call to OProp->GetOwnerUObject().

My 'fix' isn't the nicest, but I have been unable to find a way to get back from the given parameters to the containing RootObject.

It could be neater to leave the Outer as nullptr, which will create the object in the transient package, but it feels more 'correct' to set it to the parent UObject.

sinbad commented 2 years ago

Thanks, I didn't spot that it was resolving the the UClass, this change looks good. 👍