# Delete

> Starts a task to delete an Asset or a list of Assets from the disk and from the version control system.

## Definition

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

## Delete(string)

Starts a task to delete an Asset or a list of Assets from the disk and from the version control system.

```csharp
public static Task Delete(string assetProjectPath)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The path to the asset that is to be deleted.

### Returns

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [Task](/engine/6000.5/script-reference/unityeditor/versioncontrol/task.md) |             |

### Remarks

Once the task has completed the resultCode of the task will tell if the assets were successfully deleted.

Note that after this operation is completed, Asset Database is not refreshed automatically. It can be updated by calling [AssetDatabase.Refresh](/engine/6000.5/script-reference/unityeditor/assetdatabase/refresh.md).

### Examples

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour
{
    [MenuItem("Version Control/Delete")]
    public static void ExampleDelete()
    {
        AssetList assets = new AssetList();
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs"));
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs.meta"));
        Task t = Provider.Delete(assets);
        t.Wait();
    }
}
```

## Delete(AssetList)

Starts a task to delete an Asset or a list of Assets from the disk and from the version control system.

```csharp
public static Task Delete(AssetList assets)
```

### Parameters

**** (\[AssetList]\(/engine/6000.5/script-reference/unityeditor/versioncontrol/assetlist)): List of assets to delete.

### Returns

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [Task](/engine/6000.5/script-reference/unityeditor/versioncontrol/task.md) |             |

### Remarks

Once the task has completed the resultCode of the task will tell if the assets were successfully deleted.

Note that after this operation is completed, Asset Database is not refreshed automatically. It can be updated by calling [AssetDatabase.Refresh](/engine/6000.5/script-reference/unityeditor/assetdatabase/refresh.md).

### Examples

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour
{
    [MenuItem("Version Control/Delete")]
    public static void ExampleDelete()
    {
        AssetList assets = new AssetList();
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs"));
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs.meta"));
        Task t = Provider.Delete(assets);
        t.Wait();
    }
}
```

## Delete(Asset)

Starts a task to delete an Asset or a list of Assets from the disk and from the version control system.

```csharp
public static Task Delete(Asset asset)
```

### Parameters

**** (\[Asset]\(/engine/6000.5/script-reference/unityeditor/versioncontrol/asset)): Asset to delete.

### Returns

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [Task](/engine/6000.5/script-reference/unityeditor/versioncontrol/task.md) |             |

### Remarks

Once the task has completed the resultCode of the task will tell if the assets were successfully deleted.

Note that after this operation is completed, Asset Database is not refreshed automatically. It can be updated by calling [AssetDatabase.Refresh](/engine/6000.5/script-reference/unityeditor/assetdatabase/refresh.md).

### Examples

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour
{
    [MenuItem("Version Control/Delete")]
    public static void ExampleDelete()
    {
        AssetList assets = new AssetList();
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs"));
        assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs.meta"));
        Task t = Provider.Delete(assets);
        t.Wait();
    }
}
```
