PostEditChangeChainProperty is called after struct is modified

I have TMap <FString, CustomActorPtr*> . When using PostEditChangeChainProperty to catch struct modifications (TMaps are structs) like “Add, Remove, Clear” these modifications occur first then PostEditChangeChainProperty is called. This is practically useless.

In my situation I want to catch all of these before they have done anything to the struct so that I can direct how they are performed. For instance - with “Add” a TPair is created with None as the Key and nullptr as the value. I want to spawn the actor - assign it a name and use this name as the Key, and a ptr to it as the value. I’m able to get around this by first clearing the TMap, and then adding a new TPair with after I have spawned the actor.

Here’s where the real problem comes in - If I want to “Clear” - it’ll clear the TMap but the PTRs I had stored are now gone so I can’t easily get the actors for destroy(). So now I have spawned actors that I can’t easily access because PostEditChangeChainProperty is called after the modification has already taken place.

You can simply add

UPROPERTY(BlueprintSetter=NAME_OF_SETTER_FUNCTION)

then add a corresponding UFUNCTION(BlueprintSetter)

Though I dont know if it works for functions called to modify the map.

Your best bet is to just make that member private, and expose your own Add and Remove functions, or whatever you need.