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

269 Views Asked by At

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

  • Multiple .json data files.
  • A Unity scene, for a battle, which can use the above .json data files.

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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.