Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

AssetDatabase.SaveAssetIfDirty

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void SaveAssetIfDirty(Object obj);

Parameters

Parameter Description
obj The asset object to save, if it has unsaved changes.

Description

Writes any unsaved changes to an asset object to disk.

This method is similar to AssetDatabase.SaveAssets, so don't call it during serialization either. Because you specify the asset directly, it doesn't call AssetModificationProcessor.OnWillSaveAssets.


Declaration

public static void SaveAssetIfDirty(GUID guid);

Parameters

Parameter Description
guid The GUID of the asset to save, if it has unsaved changes.

Description

Writes any unsaved changes to the asset with the specified GUID to disk.

This method is similar to AssetDatabase.SaveAssets, so don't call it during serialization either. Because you specify the asset directly, it doesn't call AssetModificationProcessor.OnWillSaveAssets.