Documentation

Unity Engine

Download Unity

Unity Engine

SaveAssetIfDirty

Writes any unsaved changes to the asset with the specified GUID to disk.
Read time 1 minuteLast updated a month ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

SaveAssetIfDirty(GUID)

Writes any unsaved changes to the asset with the specified GUID to disk.
public static void SaveAssetIfDirty(GUID guid)

Parameters

guid

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

Remarks

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(string[]).

SaveAssetIfDirty(Object)

Writes any unsaved changes to an asset object to disk.
public static void SaveAssetIfDirty(Object obj)

Parameters

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

Remarks

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(string[]).