Quantcast
Channel: Questions in topic: "assetbundles"
Viewing all articles
Browse latest Browse all 312

Exception when building asset bundle with variant using build map

$
0
0
Hi, I'm trying to generate AssetBundles using a build map (array of `AssetBundleBuild` objects) sent to `BuildPipeline.BuildAssetBundles`, as is shown in the second example in the [documentation][1]. The issue appears when I try to create an asset bundle with a variant, which isn't shown in the documentation (or anywhere online). Assigning non-null-or-empty string to `AssetBundleBuild.assetBundleVariant`, I get a slew of identical errors in the inspector stating the `"Variant folder path cannot be empty."` The code I am using is: var builds = new AssetBundleBuild[2]; builds[0] = new AssetBundleBuild { assetBundleName = mainBundleName, assetBundleVariant = "variant1", assetNames = new[] { "Assets/troops/troop/variant1/troop.prefab" } }; builds[1] = new AssetBundleBuild { assetBundleName = mainBundleName, assetBundleVariant = "variant2", assetNames = new[] { "Assets/troops/troop/variant2/troop.prefab" } }; BuildPipeline.BuildAssetBundles(ASSET_BUNDLE_OUTPUT_PATH, builds, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); Based on the workaround in [this][2] similar issue, I have tried putting the asset I am trying to turn into a bundle into various folder structures with the name of the bundle/variant/etc. all to no avail. It is worth noting that when assigning the same bundle name and variant to this asset in the inspector and running BuildAssetBundles without a build map it runs fine, but I am trying to create an automated process... Any help would be greatly appreciated. Thanks! [1]: https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundles.html [2]: https://issuetracker.unity3d.com/issues/assetbundle-building-assetbundles-with-variants-produces-error-messages-in-editor-console

Viewing all articles
Browse latest Browse all 312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>