AssetBundle<就像《一》个>ZIP【压缩文件】,{内里存储着差别平台<的>特殊资源}(models/texture/prefabs/materials/audio clip/scenes...), 这些资源都可以在运行时举行“加载”。
<上《一》>章先容了,资源异步“加载”<的>方式,『这篇先容』AssetBundle资源旧<的>『打包』“加载”方式;
AssetBundle『打包』:

using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;

public class AssetbundlePack : MonoBehaviour {

    /// <summary>
    /// 【查看所有<的>】Assetbundle{名称}
    /// </summary>
    [MenuItem("AssetBundle/Get AssetBundle names")]
    static void GetAllAssetbundleNames()
    {
        var names = AssetDatabase.GetAllAssetBundleNames(); //(获取所有设置<的>)AssetBundle
        foreach (var name in names)
            Debug.Log("AssetBundle: " + name);
    }

    /// <summary>
    /// 〖自〗动『打包』所有资源
    /// </summary>
    [MenuItem("AssetBundle/Create AssetBundles")] //‘设置编辑器菜单选项’
    static void CreateAllAssetBundles()
    {
        string targetPath = Application.dataPath + "/StreamingAssets/PCAssetsResources/";
        if(!Directory.Exists(targetPath))
        {
            Directory.CreateDirectory(targetPath);
        }
        //『打包』资源
                ////参数《一》为『打包』到哪个路径,参数【二】压缩选项  ‘参数三’ {平台<的>目<的>}
        BuildPipeline.BuildAssetBundles(targetPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
        //<刷新编辑器>
        AssetDatabase.Refresh();
    }

    /// <summary>
    /// (消灭之)前设置过<的>AssetBundleName,制止发生不必要<的>资源也『打包』 
    /// 由于只要设置了AssetBundleName<的>,都市举行『打包』,“岂论在什么目”录下 
    /// </summary> 
    [MenuItem("AssetBundle/Clear All Assetbundle Name")]
    public static void ClearAssetBundlesName()
    {
        string[] oldAssetBundleNames = AssetDatabase.GetAllAssetBundleNames();
        for (int j = 0; j < oldAssetBundleNames.Length; j++)
        {
            AssetDatabase.RemoveAssetBundleName(oldAssetBundleNames[j], true);
        }
    }
} 

异步“加载”AssetBundle

  /// <summary>
    /// 「请求」AssetBundle
    /// </summary>
    /// <param name="url">AssetBundle〖地址〗</param>
    /// <param name="actionResult">「请求」提议后处置回调效果<的>委托,处置「请求」效果<的>AssetBundle</param>
    /// <returns></returns>
    IEnumerator _LoadAssetBundle(string url, Action<bool, string, AssetBundle> actionResult)
    {
         using (UnityWebRequest request = UnityWebRequest.Get(url))
        {
            DownloadHandlerAssetBundle downloadAssetBundle = new DownloadHandlerAssetBundle(url, uint.MaxValue);
            request.downloadHandler = downloadAssetBundle;
            yield return request.SendWebRequest();
            AssetBundle assetBundle = null;
            string text = null;
            if (!(request.isNetworkError || request.isHttpError))
            {
                assetBundle = downloadAssetBundle.assetBundle;
            }
            else
            {
                text = request.error;
            }
            if (actionResult != null)
            {
                actionResult.Invoke((request.isNetworkError || request.isHttpError), text, assetBundle);
            }
        }
    }

AssetBundle旧方式『打包』“加载”就先容到这里,〖自〗2018“版”Unity公布之后泛起新<的>资源管理方式Addressable,不外旧<的>依然能用,「小」我私家以为新Addressable方式用起来利便<的>多,Addressable<也是基于>AssetBundle“之上”,(下《一》篇主要先容)Addressable 使用[。