| guids | Array of GUIDs to upload to the CacheServer. If array is empty, all assets are uploaded. |
| uploadAllRevisions | Specifies if all revisions of the Assets corresponding to the supplied GUIDs should also be uploaded. Each time an Asset is edited, a new revision is created. Revisions also include non-primary artifacts. That is, artifacts not generated via their default importer for an asset type, but by another importer. One example of this is the Preview importer. That uses the same Asset GUID but a different importer to generate an asset preview. |
| force | Force of uploading artifacts to the CacheServer, even if the upload option in CacheServer setting is not enabled. |
Upload the specified GUIDs to the CacheServer. If keys is empty, all assets are uploaded.
using UnityEditor; using UnityEngine;
public class CacheServerExamples { [MenuItem("CacheServer/Upload All Assets To CacheServer")] public static void UploadAllAssetsToCacheServer() { // This will upaload all assets to the cache server CacheServer.UploadArtifacts(); } }
using UnityEditor; using UnityEngine;
public class CacheServerExamples { [MenuItem("CacheServer/Upload All Prefabs To CacheServer")] public static void UploadAllAssetsToCacheServer() { var prefabFilesGUIDs = AssetDatabase.FindAssets("t:prefab"); var guids = new GUID[prefabFilesGUIDs.Length]; var counter = 0; foreach (var curGUID in prefabFilesGUIDs) { guids[counter] = new GUID(curGUID); ++counter; } // This will upaload all prefabs to the cache server CacheServer.UploadArtifacts(guids); } }
using UnityEditor; using UnityEngine;
public class CacheServerExamples { [MenuItem("CacheServer/Upload All Scripts To CacheServer")] public static void UploadAllAssetsToCacheServer() { var scriptFileGUIDs = AssetDatabase.FindAssets("t:Script"); var guids = new GUID[scriptFileGUIDs.Length]; var counter = 0; foreach (var curGUID in scriptFileGUIDs) { guids[counter] = new GUID(curGUID); ++counter; } // This will upaload all scripts to the cache server CacheServer.UploadArtifacts(guids); } }
using UnityEditor; using UnityEngine;
public class CacheServerExamples { [MenuItem("CacheServer/Upload All Textures Versions To CacheServer")] public static void UploadAllAssetsToCacheServer() { var textureGUIDs = AssetDatabase.FindAssets("t:Texture"); var guids = new GUID[textureGUIDs .Length]; var counter = 0; foreach (var curGUID in textureGUIDs ) { guids[counter] = new GUID(curGUID); ++counter; } // This will upaload all texture versions to the cache server CacheServer.UploadArtifacts(guids, uploadAllRevisions: true); } }
using UnityEditor; using UnityEngine;
public class CacheServerExamples { [MenuItem("CacheServer/Upload All Textures Versions To CacheServer")] public static void UploadAllAssetsToCacheServer() { var textureGUIDs = AssetDatabase.FindAssets("t:Texture"); var guids = new GUID[textureGUIDs .Length]; var counter = 0; foreach (var curGUID in textureGUIDs ) { guids[counter] = new GUID(curGUID); ++counter; } // This will upaload all texture versions to the cache server, but it will not upload if the upload option is disabled in the CacheServer settings. CacheServer.UploadArtifacts(guids, uploadAllRevisions: true, force: false); } }