unity5.x assetbundle打包和加载

    xiaoxiao2021-03-26  20

    打包

    AssetBundleBuild[] abs = new AssetBundleBuild[1]; abs[0].assetNames = new string[]{"Assets/RawAssets/Cube.prefab","Assets/RawAssets/Sphere.prefab"}; abs[0].assetBundleName = "myAb.bundle"; BundlePipeline.BuildAssetBundles(Application.streamingAssetsPath+"/res",abs,BuildAssetBundleOptions.ChunkBasedCompression,BuildTarget.StandaloneWindows); 加载 AssetBundle ab = AssetBundle.LoadFromFile(Application.streamingAssetsPath+"/res/myAb.bundle"); var prefabObj = ab.LoadAsset<GameObject>("Cube"); if(null != prefabObj) { Instantiate(prefabObj); }

    转载请注明原文地址: https://ju.6miu.com/read-658858.html

    最新回复(0)