I have an Editor Utility Widget that modifies assets.
However, it seems that it doesn’t actually mark the asset as “dirty” (modified / unsaved) when it does this, so the changes will not be saved and don’t even show up in the list of files to save.
According to Asset Metadata | Unreal Engine Documentation there should be a “Save Asset” node somewhere. But I can’t find it.
I ran into the same problem. My very ugly workaround is to rename the asset to the same name. This also saves the file.
It’s ugly, but it works until a proper solution is found:
The Save Asset node is there for me in 4.24 when working with an Editor Utility Widget.
My problem is that I don’t actually want to save the asset after modifications, I just want to mark it as modified so that the user can choose to save the changes (or not) later.
I could just force-save like you’re suggesting, but it annoys me because it breaks the usual flow of the editor where you expect to be able to change something, and then close the editor without saving if you did something wrong.
Not sure if it’s required to be inside of a ‘Transaction’ to be flagged as dirty, doing it would give you not only the ability to mark it dirty but also undo actions.
I’ve been trying to apply this to a Data Asset that gets modified by my in-game level editor and it doesn’t seem to mark the asset as dirty. Is there something else I need to consider, or am I barking up the wrong tree here?
Thanks.
EDIT: This does all happen at editor-time so I don’t expect it to work at run-time.
For anyone in the future, if you did modified asset as material instance, and the change is not saved, use Save Loaded Asset node, and uncheck Only if it is Dirty bool.