unity-game-engineassetbundleaddressables

Can Unity Addressables include both assets and scenes, unlike Asset Bundles?


For example, if I want to include in a single package:

I know for a fact Asset Bundles do not support this. Once I call UnityEditor.BuildPipeline.BuildAssetBundles, this error appears: "Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "[SOMEBUNDLENAME]"."

But how about Addressables? Can they achieve this?


Solution

  • Yes, scenes can be addressable and packed with assets.

    As for packing them all in the same bundle, if those assets are not already addressable they will be packed into the same bundle.

    If you use an asset that isn't Addressable, that asset becomes an implicit dependency of the scene and the build system packs it in the same AssetBundle as the scene when you make a content build.

    However if you use addressable assets in your scene, those get packed into their own bundles based on the group.

    Addressable assets are packed into their own AssetBundles according to the group they're in.

    For details on loading/unloading addressable scenes, refer to Loading Scenes from the addressables manual.