Edit UProperty variable in array of UStruct on PostEditChangeProperty


I have a custom actor component which contains an array of UStruct.
I want to be able to validate some changed property in an element of that array of UStruct.

  1. where should it validate the property change?

I couldn’t find any function that would be called to specify if a change is valid or not, before applying the property change.
Currently I’m trying to do it in PostEditChangeProperty() instead.

Is it a proper location to “invalidate” a property change?

I already verified that each property change in an element of the struct array seems to trigger a proper call to PostEditChangeProperty() in the UActorComponent.

  1. in PostEditChangeProperty(), any idea how I could get from the FPropertyChangedEvent or UProperty object, the actual element or element index in the array whose property is being changed?

Thanks in advance,


For anyone who might encounter a similar issue:

  • use PostEditChangeChainProperty() instead of PostEditChangeProperty()
  • use GetArrayIndex() on the FPropertyChangedChainEvent parameter to get the element index whose property is being changed
  • resetting the changed property value directly (from the struct element accessed using the index) when it wasn’t considered valid, seems to work => I’m not sure if this breaks some Undo / Redo logic though …