Asset/File change monitoring

I’m trying to detect when a data asset (UDataAsset) is being modified while running the game from the editor, so that I could call a function to account for those changes without restarting the game.

Is this functionality available somewhere? If not at the asset level, maybe at the file system level?

Thanks in advance for your help!

1 Like

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

Hey, this post is quite old, sorry to revive it, I would like to do the exact same thing. Thanks a lot for answering yourself with a very good starting point I guess (Not everyone makes the effort).

But I’m just starting to learn C++, and would be super happy if you could explain a bit more how to register observers on the data asset and notify them when a property is changed. More precisely, I would like the actor who has the data asset in reference to update instantly when a property of the data asset is modified (As in this video: Sky Creator for UE4 - Demo #2 (RayTracing + DLSS) - YouTube)

Just in case you go through there :slight_smile:

Thanks!