Download

Difficulty handling serialization when changing property from TArray to Struct

Working in Unreal 4.25

I’m attempting to change the type of a property from TArray in a Struct to a Struct which contains a TArray along with other relevant data.
Unfortunately, I’ve been stumped by the conversion process when loading an asset using the original TArray.
I’ve implemented SerializeFromMismatchedTag, which seems to put be me in the context I’m interested in - a reference to the new Struct and the data from the original TArray stored in an FArchive. Unfortunately, the amount and content of the data it providing doesn’t make sense to me. For what seems like an empty TArray, it’s providing 53 bytes of data, mostly 0 with a few scattered bytes > 0.
Leaning on the default serialization for TArray, it is reading the first int32 with value 0 and then stopping, since that’s all an empty TArray is expected to write. I experimented with reading the data directly, and it seems to contain something like PropertyTag data with FNames containing the name and type of of the updated property.

Are there any guides or resources for how to handle this kind of thing?
Any guidance would be appreciated!

I usually find doing this sort of thing in PostLoad to be much easier. This does require that both the old and new members co-exist for some time, but by making the old member private you can usually hide that fact from most code that matters. It’s a little more manual as well, but it’s easier data to manipulate than an FArchive.

Once all the content of that type is resaved (either manually or through some overnight process depending on scale) you would be able to delete the old data member from the class.

Thanks for that!
I ended up taking this approach due to time constraints.
At some point I would like to understand what exactly is going on so the “proper” solution can be implemented, but that seems like a bit of a long shot.