Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SaveAssetIfDirty

Writes all unsaved changes to the specified asset to disk.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

SaveAssetIfDirty(GUID)

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

Parameters

guid

GUID
The GUID of the asset to be saved, if dirty.

Remarks

This function is similar to AssetDatabase.SaveAssets, and likewise should not be called during serialization.
It does not invoke AssetModificationProcessor.OnWillSaveAssets(string[]), as the asset is directly specified.

SaveAssetIfDirty(Object)

Writes all unsaved changes to the specified asset to disk.
public static void SaveAssetIfDirty(Object obj)

Parameters

The asset object to be saved, if dirty.

Remarks

This function is similar to AssetDatabase.SaveAssets, and likewise should not be called during serialization.
It does not invoke AssetModificationProcessor.OnWillSaveAssets(string[]), as the asset is directly specified.