Search Unity

SpriteAtlas variant in AssetBundle references master SpriteAtlas as dependency

Discussion in 'Asset Bundles' started by BBO_Lagoon, Apr 24, 2020.

  1. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    200
    Hi,
    When building an AssetBundle with a SpriteAtlas variant, the AssetBundle references the master SpriteAtlas as Dependency.

    For example, in my project I have some SpriteAtlas, each have 1 master (hd_etc2) an 3 variants (hd_astc, sd_astc and sd_etc2).

    When I build, I prepare my assets bundles HD and SD so when I build for astc I make AssetsBundles only with variants SpriteAtlases.

    When I build ALL SpriteAtlas bundles here are the size of the bundles:
    hd_astc : 30Mo => dependency on hd_etc2
    hd_etc2 : 16Mo => no dependency
    sd_astc : 9Mo => dependency on hd_etc2
    sd_etc2 : 5Mo => dependency on hd_etc2

    As you can see the variants depends on the master


    When I build ASTC ONLY SpriteAtlas bundles here are the size of the bundles:
    hd_astc : 46Mo => no dependency
    sd_astc : 27Mo => no dependency

    As you cans see it seems that the hd_etc2 is packed inside each bundles wich increase the size by 16Mo.


    Is there a way to change that ?
    Is it a bug in Unity ?

    [EDIT]

    I just sent a bug report about it, I'll post the case ID when I receive it.

    I managed to don't have the master SpriteAtlas packed in the AssetBundle containing the variant SpriteAtlas when the master SpriteAtlas is not in any AssetBundle, just unchecked the "include in build" tick in the SpriteAtlas.

    But the dependency is still there in the dependencies list of the AssetBundles manifests when the master SpriteAtlas is packed in an AssetBundle.

    So the result is unchanged when I build all SpriteAtlases in AssetBundles:
    hd_astc : 30Mo => dependency on hd_etc2
    hd_etc2 : 16Mo => no dependency
    sd_astc : 9Mo => dependency on hd_etc2
    sd_etc2 : 5Mo => dependency on hd_etc2

    And here are the new results when I build ASTC ONLY SpriteAtlas in AssetBundles:
    hd_astc : 30Mo => no dependency
    sd_astc : 9Mo => no dependency
     
    Last edited: May 20, 2020