Version: 2023.2
public CompressionType Compression ;

描述

The type of compression the archive uses.

Only accessible if the archive loaded successfully.

See Also: AssetBundles compression.

                        
using Unity.Content;
using Unity.IO.Archive;
using UnityEditor;
using UnityEngine;

public static class ArchiveUtilities { #if UNITY_EDITOR [MenuItem("Debug/Check Archive Compression")] static public void CheckCompression() { string archivePath = EditorUtility.OpenFilePanel("Pick AssetBundle or other Unity Archive file", "", ""); if (archivePath.Length == 0) return;

Debug.Log($"Bundle {archivePath} has compression type {GetArchiveCompression(archivePath)}"); } #endif

static public UnityEngine.CompressionType GetArchiveCompression(string archivePath) { var archiveHandle = ArchiveFileInterface.MountAsync(ContentNamespace.Default, archivePath, "temp:"); archiveHandle.JobHandle.Complete();

if (archiveHandle.Status == ArchiveStatus.Failed) throw new System.ArgumentException($"Failed to load {archivePath}");

var compression = archiveHandle.Compression; archiveHandle.Unmount().Complete();

return compression; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961