Version: 1.7
LanguageEnglish
  • C#

CacheServer.CheckArtifacts

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 CheckArtifacts(GUID[] guids, bool checkAllRevisions);

Parameters

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

Returns

bool Returns true if all artifacts of specified assets exist on cache server.

Description

Check existence of aritifacts on cache server with given GUID of the asset.

This method checks existence of remote artifacts of specified assets(with given GUIDs) from cache server. More details of the query will be recorded in Editor Log.

using UnityEditor;
using UnityEngine;

public static class RemoteCacheCheck { // check existence of the remote cache for the selected asset [MenuItem("Assets/Check Remote Cache", false, 21)] private static void CheckRemoteCache() { string path = AssetDatabase.GetAssetPath(Selection.objects[0]);

if (!string.IsNullOrEmpty(path)) { string fileID = GetFileID(path); GUID[] guids = { new GUID(fileID) }; if (CacheServer.CheckArtifacts(guids, false)) { Debug.Log($"Remote cache exists for: {path}"); AssetDatabase.Refresh(); } else { Debug.LogWarning($"Remote cache does not exist for: {path}"); } } }

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