Search Unity

Packed Mode have SpriteAtlas problem

Discussion in 'Addressables' started by MomochaZ, Dec 10, 2018.

  1. MomochaZ

    MomochaZ

    Joined:
    Jun 20, 2013
    Posts:
    28
    Hi,everyone.

    I use the packed mode and set remote path.
    I also set my prefab and sprite atlas into addressable.
    Then I start build and copy the bundle and catlog to my remote path.
    But when in runtime,my prefab background image shows white.

    I already add event in SpriteAtlasManager.atlasRequested and in the event I use Addressables.LoadAsset to load sprite atlas.
    I have log the asset.It is not null.

    Does someone have the same issue,too.
    Please help me to solve this problem.
    Thanks.
     
  2. alexnown

    alexnown

    Joined:
    Oct 25, 2018
    Posts:
    22
    Did you invoke callback after loading the atlas?
    Code (CSharp):
    1. private void SpriteAtlasManager_atlasRequested(string atlasTag, Action<SpriteAtlas> callback)
    2. {
    3.       Addressables.LoadAsset<SpriteAtlas>(atlasTag).Completed += operation =>
    4.       {
    5.                 if (operation.Result != null)
    6.                 {
    7.                     callback.Invoke(operation.Result);
    8.                 }
    9.                 else Debug.LogError($"Atlas with tag {atlasTag} not found in addressables.");
    10.         };
    11. }
     
  3. MomochaZ

    MomochaZ

    Joined:
    Jun 20, 2013
    Posts:
    28
    I did.
    Code (CSharp):
    1. private void OnAtlasRequested(string name , Action<SpriteAtlas> callBack)
    2.     {
    3.         Addressables.LoadAsset<SpriteAtlas>(name).Completed += (op) =>
    4.         {
    5.             callBack(op.Result);
    6.      
    7.             Addressables.ReleaseAsset(op.Result);
    8.             Resources.UnloadAsset(op.Result);
    9.         };
    10.     }
     
  4. MomochaZ

    MomochaZ

    Joined:
    Jun 20, 2013
    Posts:
    28
    Hi.
    In sprite atlas I set two texture(2048*1024) each size about 2MB to pack.
    I check the bundle it only have 4KB.
    It seems doesn't pack the texture?
    But I can still find these two sprite info like width,height,and name in sprite atlas.
    Still can find out what reason occurs it.:(
     
  5. alexnown

    alexnown

    Joined:
    Oct 25, 2018
    Posts:
    22
    Can you attach project with this sample?
     
  6. fmodesto

    fmodesto

    Joined:
    Jan 7, 2019
    Posts:
    1
    Good day to all.

    Does anyone have a permanent solution for this issue?
    As of this moment, on Addressables 0.5.3 the issue is still ongoing.
    The atlases aren't packed into the .asset groups most of the time.
    The issue seems random.

    Cold Starting Unity, cleaning the Addressable Data, deleting the Streaming Assets folders. Repacking the atlases individually, saving the project, building the content is the only way we have managed to get the atlases to get packed, and even then it's not something that always happens. Only about 20% of the time do the atlases actually get packed into the .asset file. Nevertheless, the atlases are listed in the json catalog file.
    There seems to be some sort of silent packing error.
     
  7. dave_thrive

    dave_thrive

    Joined:
    Jan 30, 2019
    Posts:
    35
    I'm noticing something similar. I have an atlas that is included in one of my addressable asset bundles. All the images for this atlas are also tagged to be included in the bundle. When I do a build however, the source images are all included in the build despite only being referenced by the atlas which should be in a bundle. If I delete the atlas then all the images are no longer included in the main app build.
     
  8. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
  9. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    There's a lot going on in this thread, so I'm not sure if what I'm about to say addresses this, but there's an engine issue causing multi-page sprite atlases to not work (page 1 should, but not subsequent pages). It's fixed in 2019.2 alpha, and is working it's way backwards to 19.1, then eventually 2018.3.
     
    nik_d likes this.