# Validating UPROPERTY changes in editor (in general)

**URL:** <https://forums.unrealengine.com/t/validating-uproperty-changes-in-editor-in-general/318621>\
**Category:** Audio\
**Tags:** properties, unreal-engine, editor, question\
**Created:** [May 14, 2015, 5:02pm UTC](https://forums.unrealengine.com/t/validating-uproperty-changes-in-editor-in-general/318621 "2015-05-14T17:02:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e1690214](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e1690214](https://forums.unrealengine.com/u/anonymous_user_e1690214)\
**Post date:** [May 14, 2015, 5:02pm UTC](https://forums.unrealengine.com/t/validating-uproperty-changes-in-editor-in-general/318621/1 "2015-05-14T17:02:21Z")

</div>

In [this question](https://answers.unrealengine.com/questions/147511/validating-uproperty-change.html), I wondered how to force a particular `TSubclassOf<>` UPROPERTY to be non-None. It turned out there was a particular keyword which specifically selected that behavior, so hooray for that.

But more in general, I’m often running into situations where setting a particular `UObject` property in the editor should be validated/handled in some way. Certain validation behaviors have associated metadata types (think `ClampMin/Max`, `NoElementDuplicate`, etc., but there isn’t always one which fits.

What I’d like, basically, is some way of custom-validating property changes which happen in the editor. `UObject::PostEditChangeProperty` is _tantalizingly close_ to fitting the bill, except that when it fires, the change has already been made, and there’s no way to find out what the old value was, so it can’t be reverted. (Similarly, `PreEditChange` happens too soon; there’s no way to know what the new value will be).

One option might be to instantly undo the change from `PostEditChangeProperty`… but initiating an undo from within a notification callback sounds dangerous, and I’m not actually sure how to go about it.

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [May 15, 2015, 5:23pm UTC](https://forums.unrealengine.com/t/validating-uproperty-changes-in-editor-in-general/318621/2 "2015-05-15T17:23:10Z")

</div>

You can achieve this using [Details Customizations](https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCEQFjAA&url=https%3A%2F%2Fdocs.unrealengine.com%2Flatest%2FFRA%2FProgramming%2FSlate%2FDetailsCustomization%2Findex.html&ei=PSpWVfqeMIGfyAOOkoCoBw&usg=AFQjCNFKfZxbESo_j96cPFpGANY3nLZ2_Q&sig2=T7gPARDRPU8mgY0HaTdu7A) (link a bit out of date but there are loads of examples in the engine source). It gives you total control, but unfortunately is kind of heavy. I agree it would be much nicer if it was possible to do proper property validation through PostEditChangeProperty, but like you I have not found a way to do so when you need to know the previous value.

That said, the codebase is huge so it’s possible this can be done more concisely than with Details Customizations and it just needs documenting…

---

<div class="post-metadata">

**Author:** ![Guy\_Paddock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Guy\_Paddock](https://forums.unrealengine.com/u/Guy_Paddock)\
**Post date:** [September 17, 2023, 4:26am UTC](https://forums.unrealengine.com/t/validating-uproperty-changes-in-editor-in-general/318621/3 "2023-09-17T04:26:00Z")

</div>

For anyone stumbling on this old thread, check out `UObject::IsDataValid`. There’s an example of it from the engine in `UInputAction::IsDataValid` (for validating Enhanced Input actions).
