I’ve been trying to wrap my head around how I should structure sprites and atlases for addressables and reading the documentation seems to suggest that if all the sprites and the atlas are in a bundle then I would get meta data from the sprites and the atlas would contain the texture.
This time, the SpriteAtlas from the previous example is marked as Addressable in its own AssetBundle. Unity now creates four AssetBundles. The three AssetBundles with the sprites are each only a few KB and have a dependency on the fourth AssetBundle, which contains the SpriteAtlas and is about 1500KB.
However in a very simple test that I’ve put together with 4 sprites (~120-160KB) and an atlas (results in ~1MB texture) it would appear that all 4 sprites AND the atlas get included in the bundle if I’m reading the buildlayout report correctly (all things are set to uncompressed so I can use the size as an additional indicator).
Group TestAssets (Bundles: 1, Total Size: 1.58MB, Explicit Asset Count: 5)
Schemas
BundledAssetGroupSchema (InternalBundleIdMode: GroupGuidProjectIdHash, Compression: Uncompressed, IncludeAddressInCatalog: True, IncludeGUIDInCatalog: True, IncludeLabelsInCatalog: True, InternalIdNamingMode: FullPath, AssetBundledCacheClearBehavior: ClearWhenSpaceIsNeededInCache, IncludeInBuild: True, BundledAssetProviderType: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider, ForceUniqueProvider: False, UseAssetBundleCache: True, UseAssetBundleCrc: True, UseAssetBundleCrcForCachedBundles: True, UseUnityWebRequestForLocalBundles: False, Timeout: 0, ChunkedTransfer: False, RedirectLimit: -1, RetryCount: 0, BuildPath: Library/com.unity.addressables/aa/Windows/StandaloneWindows64, LoadPath: {UnityEngine.AddressableAssets.Addressables.RuntimePath}/StandaloneWindows64, PackingMode: PackTogether, HostingServicesContentRoot: Library/com.unity.addressables/aa/Windows/StandaloneWindows64, AssetBundleProviderType: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider, BundleNaming: AppendHash, AssetLoadMode: RequestedAssetAndDependencies)
ContentUpdateGroupSchema (StaticContent: False)
Archive testassets_assets_all_7d06a3ca4ab406783c41ea6d1642571a.bundle (Size: 1.58MB, Compression: None, Asset Bundle Object Size: 1.01KB)
Bundle Dependencies:
Expanded Bundle Dependencies:
Explicit Assets
Assets/Tests/TestAssets/Sprites/player-warrior-idle1.png (Total Size: 166.84KB, Size from Objects: 166.84KB, Size from Streamed Data: 0B, File Index: 0, Addressable Name: Assets/Tests/TestAssets/Sprites/player-warrior-idle1.png)
Assets/Tests/TestAssets/Sprites/player-warrior-move1.png (Total Size: 159.73KB, Size from Objects: 159.73KB, Size from Streamed Data: 0B, File Index: 0, Addressable Name: Assets/Tests/TestAssets/Sprites/player-warrior-move1.png)
Assets/Tests/TestAssets/Sprites/player-warrior-potion1.png (Total Size: 128.98KB, Size from Objects: 128.98KB, Size from Streamed Data: 0B, File Index: 0, Addressable Name: Assets/Tests/TestAssets/Sprites/player-warrior-potion1.png)
Assets/Tests/TestAssets/Sprites/player-warrior-scroll1.png (Total Size: 124.17KB, Size from Objects: 124.17KB, Size from Streamed Data: 0B, File Index: 0, Addressable Name: Assets/Tests/TestAssets/Sprites/player-warrior-scroll1.png)
Assets/Tests/TestAssets/test-atlas.spriteatlas (Total Size: 632B, Size from Objects: 632B, Size from Streamed Data: 0B, File Index: 0, Addressable Name: Assets/Tests/TestAssets/test-atlas.spriteatlas)
Internal References: Library/AtlasCache/a7/a702662e1ead9a35c2ab59021489b13c
Files:
File 0 (MonoScripts: 0, MonoScript Size: 0B)
CAB-9379d24160e18f2897944898cf5361fd (Size: 594.28KB)
CAB-9379d24160e18f2897944898cf5361fd.resS (Size: 1MB)
Data From Other Assets (1)
Library/AtlasCache/a7/a702662e1ead9a35c2ab59021489b13c (Size: 1MB, Size from Objects: 244B, Size from Streamed Data: 1MB, Object Count: 1)
Referencing Assets: Assets/Tests/TestAssets/test-atlas.spriteatlas
The total size of the bundle is ~1.5MB which is indicating that all 4 sprites and the atlas texture are being included which isn’t really what I want.
Am I misunderstanding the documentation or not understanding the buildlayout report?
Addressables: 1.21.14
Unity: 2020.3.17f1
Thanks!