Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question SpriteAtlas, AssetBundles and 'Include in Build'

Discussion in '2D' started by AnthonyReddan, Jul 16, 2020.

  1. AnthonyReddan

    AnthonyReddan

    Joined:
    Feb 27, 2018
    Posts:
    39
    I've seen now in a number of places that 'Include in Build' simply means that a Sprite will correctly reference its SpriteAtlas (even if its in an asset bundle), like from here:

    However, it seems that by checking this box, Unity is including the SpriteAtlas in my aab/apk build. I can see the textures in the build report (taking up 1.8% of the size). Also, the aab/apk size increases when I check this box.

    Is this the case or is there something potentially wrong with my setup? We obviously don't want our SpriteAtlas in the build if they're in AssetBundles. I know I can do LateBinding but I'm just looking for clarity on how this is actually supposed to function.
     
  2. AnthonyReddan

    AnthonyReddan

    Joined:
    Feb 27, 2018
    Posts:
    39
    Managed to figure it out. There were UI prefabs in the build that were referencing Sprites from the atlases. Unity was forced to include them in this case. I'm solving it by implementing a separate script to load SpriteAtlases on demand.