My TArray of struct (or UObject*) populated during PostEditChangeProperty gets cleared immediately

The problem I am trying to solve :

An ActorComponent I have created, let’s call it UMyActorComponent, needs to populate one of its properties, let’s call it MyArrayOfItems, with data analyzed and generated from another component, in my case the UStaticMesh component. This process can be very slow, and produces “static” data that will not change during play-time, so it is unacceptable to call this generation process on BeginPlay. I want to call this process “on demand” from the level designer, in the editor.

The approach I have taken so far :

Back to the original question, one way of doing this has been to overload PostEditChangeProperty and wait for a DoGenerate boolean UPROPERTY to be raised, at which point I execute my generation process, and populate MyArrayOfItems (and then lower the DoGenerate flag).

This seems to work without a problem for a TArray of uint32 or any base type, but fails as soon as the elements of the array are either structs or UObject pointers (even when these UObjects are created with my component as their Outer). It fails by simply emptying the array, destroying my objects in the process. In fact, I have noticed by tracing that the original, populated instance of my component is actually replaced in the level, and values of the property I have populated are not copied over (although they are for arrays of base types, which greatly adds to my confusion).

My plea :

Firstly, is there a better hook for such a generation of data, other than PostEditChangeProperty? Maybe the UAssetUserData API?

Secondly, any idea why my array of properties gets cleared / not copied over ? Note that I use default UPROPERTY specifies for both structs and UObjects, since I have found none that actually changed that behavior.

I am facing the same issue.