unity-game-engine - AssetBundleBuild 可寻址名称与 Assets 名称

标签 unity-game-engine

有人可以帮助我理解 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/

相关文章:

java - 使用统一实现 AndroidJavaClass

c# - 在 Unity 中存储只读数据的良好实践

android - 为什么调用外部 java 函数会导致我的应用程序崩溃? (亚马逊 SNS、S3)

android - 使用移动浏览器(Unity webgl)时如何强制横向模式?

c# - Unity - 如果我使用自己的 Start() 方法创建两个脚本,哪一个将首先调用?

c# - 如何在多边形内生成随机 Vector3 点

c# - 在 Unity 中使用 Sprite 作为按钮

unity-game-engine - "stamp"正确的是 Unity 中游戏对象上的图像吗?

ios - ar6unity iOS 上的 Apple Mach-O 链接器 (Id) 错误

c# - 当让相机跟随球时,哪一个应该控制相机位置?球还是相机本身?