Hi UDN Friends!
I’d like to serialize some data over my object from an FArchive and it doesn’t look like that will mark the replicated properties dirty in the flow I’m using. Is there an existing / recommended way to do this? Or should we homebrew something?
Thanks!
Josh
Hi,
Sorry for the delay in getting back to you!
I don’t believe there is any existing or recommended way to go about doing this, as it is generally left up to the class to handle marking properties as dirty when they are changed, regardless of how the property is set.
The simplest solution would be to just call ForcePropertyCompare after serializing the data, forcing all the properties to be treated as dirty. This obviously may not be ideal though, as it could result in a lot of properties being unnecessarily compared.
Like you mentioned, another option would be to do some custom handling, such as in a custom Serialize function or in a derived FArchive class.
FArchive does include the ability to push/pop the FProperty being serialized to a chain of properties (FArchive::Push/PopSerializedProperty). After running some tests, I’m not sure you could use this with the default AActor/UObject::Serialize path (it seems not every property gets pushed when loading from an archive here), but if you have your own serialize function, you could include handling there to track the properties. Then, perhaps in an overridden PopSerializedProperty function on a derived FArchive class, you could get the object and property that was just serialized, check if it is replicated, and then mark it as dirty.
Thanks,
Alex
Hey Alex!
Thanks! I will look into that! I’ve been using the default Serialize, but maybe it’s covering the properties I need examined.
Thanks again!
Josh