Version: 1.8
LanguageEnglish
  • C#

CacheServer.DeleteArtifacts

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool DeleteArtifacts(GUID[] guids, bool deleteAllRevisions);

Parameters

guids GUIDs of assets to be deleted from cache server.
deleteAllRevisions Specify whether all artifact revisions of the asset kept by editor will be deleted from cache server. If false, only current artifact revision will be deleted.

Returns

bool Returns true if all artifacts are successfully deleted from cache server.

Description

Delete aritifacts from cache server with given GUID of the asset.

This method deletes remote artifacts of specified assets(with given GUIDs) from cache server. Please note that if the artifact to be deleted does not exist on the cache server, the deletion will be considered successful. You can use CacheServer.CheckArtifacts to check whether artifacts of an asset exist on cache server. More details of the deletion will be recorded in Editor Log.

using UnityEditor;
using UnityEngine;

public static class RemoteCacheDeleter { // delete the remote cache for the selected asset [MenuItem("Assets/Delete Remote Cache", false, 20)] private static void DeleteRemoteCache() { string path = AssetDatabase.GetAssetPath(Selection.objects[0]);

if (!string.IsNullOrEmpty(path)) { string fileID = GetFileID(path); GUID[] guids = { new GUID(fileID) }; if (CacheServer.DeleteArtifacts(guids, false)) { Debug.Log($"Remote cache for {path} deleted successfully."); AssetDatabase.Refresh(); } else { Debug.LogWarning($"Failed to delete remote cache for {path}."); } } }

private static string GetFileID(string path) { return AssetDatabase.AssetPathToGUID(path); } }