# C++ property modifications (PostEditChange) are not saved

**URL:** <https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 13, 2022, 12:48am UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526 "2022-07-13T00:48:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [July 13, 2022, 12:48am UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/1 "2022-07-13T00:48:36Z")

</div>

Using these methods to set properties on objects held by a blueprint asset:

```auto
PreEditChange(InTargetProperty);
//
InTargetProperty->CopyCompleteValue(InTargetAddress, InSourceAddress);
//
FPropertyChangedEvent PropertyEvent(InTargetProperty);
InTargetWidget->PostEditChangeProperty(PropertyEvent);

```

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:

```auto
SomeBlueprintAsset->Modify();

```

causes the “save \*” star to appear on the asset but again does not save the changes made through “EditChangeProperty”.

Why is this happening?

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [July 13, 2022, 9:25pm UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/2 "2022-07-13T21:25:55Z")

</div>

Bump

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [July 13, 2022, 10:09pm UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/3 "2022-07-13T22:09:12Z")

</div>

Hi @Chatouille , you know a lot about these things 🙂 .  
You solved this previous post:

> [Copying FProperty from struct to struct?](https://forums.unrealengine.com/t/copying-fproperty-from-struct-to-struct/591108)

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?

---

<div class="post-metadata">

**Author:** ![Fluppi393](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fluppi393](https://forums.unrealengine.com/u/Fluppi393)\
**Post date:** [July 14, 2022, 6:58am UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/4 "2022-07-14T06:58:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [July 15, 2022, 6:20am UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/5 "2022-07-15T06:20:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![olivier.perrault](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@olivier.perrault](https://forums.unrealengine.com/u/olivier.perrault)\
**Post date:** [November 22, 2023, 4:25pm UTC](https://forums.unrealengine.com/t/c-property-modifications-posteditchange-are-not-saved/603526/6 "2023-11-22T16:25:57Z")

</div>

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.
