As the title suggests, a property change can trigger multiple calls of PostEditChangeProperty. The function might run once or 3+ times. When creating a Blueprint subclass it also happened that with every Blueprint compile the number of calls incremented. I stopped at ~10 for 1 property change.
Steps to reproduce: New C++ project. New C++ Actor (or anyhting that has PostEditChangeProperty I guess). Override PostEditChangeProperty and just do a UE_LOG. If it behaves fine just try another class or project (I first noticed it when adjusting the character in the C++ FPS template). edit: Forgot to mention to create a BP subclass and change the propperty in the editor. I assume this function is only called when making changes to the property in the editor as it is often enclosed in a WITH_EDITOR macro. Not sure on this one though.
I am not too confident when it comes to UE4 programming, therefore I am cautious when calling something a bug, but this issue seems so basic that I just don’t see what could be wrong on my end. I am still on 4.17.1 but the changelog of 4.17.2 didn’t mention anything relevant.
I suppose that PostEditChangeProperty called for every actor placede in your level too(just like Construction script). So check number of calls in empty level.
Parent/child relationship might be another source for this behaviour, but I never check this.
It’s here in 5.3 too, specifically with a BP getter/setter combination. Albeit the editor’s details view never actually calls the setter function, it just updates the underlying property directly…
UPROPERTY(EditAnywhere, Category = "Carousel", BlueprintGetter = "GetActiveIndex", BlueprintSetter = "SetActiveIndex")
uint8 activeIndex = 0;
void UCarousel::PostEditChangeProperty(FPropertyChangedEvent& e) {
Super::PostEditChangeProperty(e);
if (e.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UCarousel, activeIndex)) {
//Manually calling the setter so it's logic gets run
SetActiveIndex(activeIndex );
}
}
Ordinarily this extra call doesn’t have much of an impact, unless you’re making configuration changes that rely on the pre-change value from, PreEditChange and the post change value, then things go sideways.
Update:
If one logs the value of e.ChangeType the first call is an expected (I just entered a new value) EPropertyChangeType::ValueSet, the second call however is EPropertyChangeType::Unspecified so it’s at least possible to filter-out some duplicate calls.