# SaveAssetIfDirty

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/7000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## SaveAssetIfDirty(GUID)

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

```csharp
public static void SaveAssetIfDirty(GUID guid)
```

### Parameters

**** (GUID): The GUID of the asset to save, if it has unsaved changes.

### Remarks

This method is similar to [AssetDatabase.SaveAssets](/engine/7000.0/script-reference/unityeditor/assetdatabase/saveassets.md), so don't call it during serialization either. Because you specify the asset directly, it doesn't call [AssetModificationProcessor.OnWillSaveAssets(string\[\])](/engine/7000.0/script-reference/unityeditor/assetmodificationprocessor/onwillsaveassets.md).

## SaveAssetIfDirty(Object)

Writes any unsaved changes to an asset object to disk.

```csharp
public static void SaveAssetIfDirty(Object obj)
```

### Parameters

**** (\[Object]\(/engine/7000.0/script-reference/unityengine/object)): The asset object to save, if it has unsaved changes.

### Remarks

This method is similar to [AssetDatabase.SaveAssets](/engine/7000.0/script-reference/unityeditor/assetdatabase/saveassets.md), so don't call it during serialization either. Because you specify the asset directly, it doesn't call [AssetModificationProcessor.OnWillSaveAssets(string\[\])](/engine/7000.0/script-reference/unityeditor/assetmodificationprocessor/onwillsaveassets.md).
