有人可以帮助我理解 AssetBundleBuild.addressableNames 和 AssetBundleBuild.assetNames 之间的区别吗?
我还可以使用带有 AssetBundleBuild[] 参数的 BuildPipeline.BuildAssetBundles 来构建特定的资源包而不是所有资源包(没有此参数的重载)?
最佳答案
AssetBundleBuild.assetNames
标识捆绑 Assets 的确切位置和名称。。 (假设buildMap的类型为AssetBundleBuild
)
buildMap[0].assetNames[0] = "Assets/Textures/stinky_pupper_smol.jpg";
AssetBundleBuild.addressableNames
是一个可选昵称,用于加载其数组索引对应的资源。
buildMap[0].addressableNames[0] = "DogTexture";
这一切都是在构建时完成的,因此在运行时您可以像这样加载该纹理(假设bundle的类型为AssetBundle
):
bundle.LoadAsset("DogTexture");
而不是:
bundle.LoadAsset("Assets/Textures/stinky_pupper_smol.jpg");
对于你的第二个问题,是的。 BuildPipeline.BuildAssetBundles的过载使用 AssetBundleBuild[]
作为参数将忽略编辑器中标识的包:
This variant of the function lets you specify the names and contents of the bundles using a "build map" rather than with the details set in the editor. The map is simply an array of AssetBundleBuild objects, each of which contains a bundle name and a list of the names of asset files to be added to the named bundle.
关于unity-game-engine - AssetBundleBuild 可寻址名称与 Assets 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48979419/