因此,我已经通读了Unity5 AssetBundle的更改,并完美地理解了它们。我的问题是,很多功能已经“过时”了,但这些函数似乎仍然有效,而且Unity5文档实际上正在使用过时的函数。
我主要关心的是,我现在如何在Unity5中获取预制件的目录,并将所有预制件分别转换为各自独立的AssetBundles?不只是一个包含所有内容的AssetBundle,而是每个内置于它自己单独的AssetBundle中?
理想情况下,我会使用BuildPipeline.BuildAssetBundle函数。但unity5说,这已经过时了。但是如果你看这里:http://docs.unity3d.com/500/Documentation/Manual/managingassetdependencies.html
他们正在使用手册中的那个功能。
此外,它还说CollectDependencies选项已经过时,不再需要。但是我从我的代码中删除了它,然后Unity吐出了错误:
Please specify BuildAssetBundleOptions.CollectDependencies or collect GameObject's components and pass as 'assets' parameter.发布于 2015-05-05 20:10:13
新的BuildPipeline.BuildAssetBundles接受AssetBundleBuild数组作为输入。您可以创建一个AssetBundleBuild[],并在其中填充您想要的所有预制组件,作为单独的捆绑包:
//Create an array for 2 different prefabs.
AssetBundleBuild[] buildMap = new AssetBundleBuild[2];
//Make a buildMap for the first prefab.
AssetBundleBuild buildInfo1 = new AssetBundleBuild();
//The name of the bundle that the prefab will be saved as.
buildInfo1.assetBundleName = bundle1Name+".unity3d";
//Only one file for this prefab.
string[] prefabs1 = new string[1];
//The full path to the prefab.
prefabs[0] = prefab1Path;
buildInfo1.assetNames = prefabs1;
buildMap[0] = buildInfo1;
AssetBundleBuild buildInfo2 = new AssetBundleBuild();
//The name of the bundle that the prefab will be saved as.
buildInfo2.assetBundleName = bundle2Name+".unity3d";
//Only one file for this prefab.
string[] prefabs2 = new string[1];
//The full path to the prefab.
prefabs[0] = prefab2Path;
buildInfo2.assetNames = prefabs2;
buildMap[0] = buildInfo2
//Save the prefabs as bundles to the "bundleFolder" path.
BuildPipeline.BuildAssetBundles(bundleFolder, buildMap)https://stackoverflow.com/questions/28922995
复制相似问题