Version: 1.7
LanguageEnglish
  • C#

CacheServer.DelayUpload

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 void DelayUpload(GUID[] guids, bool immediate);

Parameters

guids Array of GUIDs to upload to the CacheServer after OnPostprocessAllAssets execution or Editor exit.
immediate Controls when upload occurs: `true`: Immediately uploads the specified GUIDs array upon completion of the OnPostprocessAllAssets event. `false`: Uploads all assets persisted to disk during Editor shutdown, ignoring the GUIDs array.

Description

Queues specified assets for upload to the CacheServer while providing precise control over upload timing behavior.

using UnityEditor;
using UnityEngine;

public class CustomAssetPostprocessor : AssetPostprocessor { private static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { var guids = new GUID[importedAssets.Length]; int index = 0; foreach (string assetPath in importedAssets) { if (assetPath.EndsWith(".prefab")) { guids[index] = AssetDatabase.GUIDFromAssetPath(assetPath); index++; } } CacheServer.DelayUpload(guids, true); // process each imported asset ... } }