Search Unity

SpriteAtlas Late Binding stops working after unloading SpriteAtlas AssetBundle

Discussion in 'Asset Bundles' started by aresgameshk, Oct 3, 2019.

  1. aresgameshk

    aresgameshk

    Joined:
    May 19, 2014
    Posts:
    32
    SpriteAtlas Late Binding stops working after unloading SpriteAtlas AssetBundle with AssetBundle.Unload(false).
    The loaded SpriteAtlas is still kept in memory and only the bundle is unloaded, but all future loaded UI will not be able to load sprites via late binding anymore.
    New UI sprites also does not request for an atlas again neither, and simply returns a broken sprite.

    I have included a small test project to demonstrate this. (2018.4 LTS)

    Load up the project and play "TestScene", you will see several buttons on screen.

    Error case:
    1) Click "Load Sprite Atlas" which will load the AssetBundle and the SpriteAtlas asset into memory.
    2) Click "Load Canvas 1" which will load and instantiate a new UI Image prefab from another AssetBundle. Notice this will load the image correctly.
    3) Click "Unload Sprite Atlas Bundle" which will unload the AssetBundle, notice the SpriteAtlas is still alive in memory.
    4) Click "Load Canvas 2" which will load and instantiate another UI Image prefab from another AssetBundle. Notice this will NOT load the image correctly.

    Control case:
    1) Click "Load Sprite Atlas" which will load the AssetBundle and the SpriteAtlas asset into memory.
    2) Click "Load Canvas 1" which will load and instantiate a new UI Image prefab from another AssetBundle. Notice this will load the image correctly.
    3) Click "Load Canvas 2" which will load and instantiate another UI Image prefab from another AssetBundle. Notice this will load the image correctly.
     

    Attached Files:

    Last edited: Oct 3, 2019
  2. aresgameshk

    aresgameshk

    Joined:
    May 19, 2014
    Posts:
    32
    Anyone else having this problem?
    We are forced to keep the spriteatlas bundle loaded right now.
     
  3. kavenGw

    kavenGw

    Joined:
    Apr 25, 2018
    Posts:
    2
    Hello, is this problem solved? I have been troubled by this for a long time
     
  4. AccountCapstones

    AccountCapstones

    Joined:
    Aug 3, 2020
    Posts:
    1
    This bug is unfixed in 2019.4.8. We need response from Unity.
     
  5. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    483
    You need to file a bug or there will be zero response from Unity at all.
     
unityunity