Asset/File change monitoring

Answering my own question as I discovered UObject::PostEditChangeProperty in the meantime.

Thanks to this notification, I can register observers on the data asset and notify them when a property is changed.
Nevertheless, I’m still interested in knowing if other options are available…

in .h:

UCLASS()
class UMyDataAsset : public UDataAsset
{
    GENERATED_BODY()

public:

#if WITH_EDITOR
    virtual void PostEditChangeProperty( FPropertyChangedEvent & PropertyChangedEvent ) override;

    DECLARE_EVENT( UMyDataAsset , FOnChanged );
    FOnChanged OnChanged;
#endif
    
    // ... some UPROPERTY() here
};

in cpp:

#if WITH_EDITOR
    void UMyDataAsset ::PostEditChangeProperty( FPropertyChangedEvent & PropertyChangedEvent )
    {
        Super::PostEditChangeProperty( PropertyChangedEvent );
        OnChanged.Broadcast();
    }
#endif
2 Likes