天天看點

01AssetBundle

01:定義

01AssetBundle
01AssetBundle
01AssetBundle
01AssetBundle
01AssetBundle

02:使用流程

01AssetBundle
01AssetBundle
01AssetBundle
01AssetBundle

03:操作步驟

1建立一個預制體wall

并設定AssetBundle的名字和字尾

01AssetBundle

2在編輯器檔案夾建立腳本CreatAssetBundles

/****************************************************
    檔案:CreatAssetBundles.cs
    作者:唐孝輝    郵箱: [email protected]
    日期:#CreateTime#
    功能:Nothing
*****************************************************/

using System.IO;
using UnityEngine;
using UnityEditor;
public class CreatAssetBundles 
{
    [MenuItem("Assets/CreatAssetBundle")]
    public static void CreatAssetBundle()
    {
        //建立一個輸出的路徑
        string file = "Assets/AssetBundles";
        //判斷是否存在某個檔案夾
        if (!Directory.Exists(file))
        {
            //從指定路徑建立檔案夾
            Directory.CreateDirectory(file);
        }
        //打包 
        //參數01 輸出目錄 03打包的使用平台
        BuildPipeline.BuildAssetBundles(file, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
        //重新整理編輯器 
        AssetDatabase.Refresh()
    }
}      
01AssetBundle

04:注意事項

可以通過"scene/wall"來建立一個字的目錄存放

05:

Manifest檔案說明

ManifestFileVersion:檔案的版本資訊

CRC

Hashes:哈希資訊,包含兩種

(AssetFileHash:資源檔案的哈希資訊,表示了包含在這個AssetBundle中的所有資源的哈希資訊,僅用于重建;

TypeTreeHash:類型樹的哈希資訊,表示了包含在這個AssetBundle中的所有類型的哈希資訊,僅用于重建。)

ClassTypes:類的類型值,包含在這個AssetBundle中所有的類的類型值,當進行類型樹的增量重建時,這些會用來擷取新的哈希值

Assets:資源路徑名稱,包含在這個AssetBundle中的所有資源的路徑名

Dependencies:依賴的所有Assetbundle的路徑名稱