文档

Unity Engine

Unity Engine

SaveAssetIfDirty

Writes any unsaved changes to the asset with the specified GUID to disk.
阅读时间1 分钟最后更新于 25 天前

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