Properties are then supposed to save on the blueprint asset the object(s) are generated by.
Oddly, while the properties update properly and the editor reflects this, the asset does not save the edits to its CDO.
Manually marking the asset dirty:
SomeBlueprintAsset->Modify();
causes the “save *” star to appear on the asset but again does not save the changes made through “EditChangeProperty”.
The code I wrote sets properties while working in the editor. It sort of simulates a user changing properties from the details panel. However, editor interaction is skipped entirely and the above few lines are used to set property values. The result is that these changes are not saved in the CDO as they would if a user interacts with the details panel. How can I save these changes to CDO automatically?
Not sure if this will work in your case, but setting serialized properties in virtual void PreSave(const ITargetPlatform* TargetPlatform) override; works for me, no need to call PreEditChange, PostEditChange or MarkDirty. As far as I remember there was some weirdness going on with widget blueprints though as they reset their properties differently to other blueprints, you will have to test if it works for you.
This is it. It seems there is absolutely no other way as I tried to find one for days. If you are lucky to work with an editor extension (detail panels etc.) you can make use of property handles and property nodes, but these are otherwise inaccessible (strange indeed, as they’d make automation really easy). Setting values on a preview object during PreSave seems to write them permanently to the CDO as well.
It would be great to have access to PostEditChange, PostEditChangeChainProperty inside UActorComponent. With the workaround mentioned above, no way to tell which property was changed.