Unity5 AssetBundle features deprecated?

So, I read the Unity5 AssetBundle changes and understand them perfectly. My problem is that many functions were "deprecated", but the functions seem to still work, and the Unity5 documentation actually uses deprecated functions.

My main concern is how I now, in Unity5, take the catalog of collections and turn them all into my own separate AssetBundles separately? Not only one AssetBundle containing everything, but each built-in own separate AssetBundle?

Ideally, I would use the BuildPipeline.BuildAssetBundle function. But unity5 says that it is out of date. But if you look here: http://docs.unity3d.com/500/Documentation/Manual/managingassetdependencies.html

They use this feature in a manual.

He also says that the CollectDependencies option is deprecated and no longer needed. But I removed it from my code, and then Unity spat out an error:

Please specify BuildAssetBundleOptions.CollectDependencies or collect GameObject components and pass as 'assets' parameter. 
+6
source share
1 answer

The new BuildPipeline.BuildAssetBundles accepts an AssetBundleBuild array as input. You can create AssetBundleBuild[] and populate it with all the ready-made assemblies you want as separate packages:

 //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) 
+5
source

Source: https://habr.com/ru/post/983487/


All Articles