Search Unity

[v1.5.0] Addressable Name of a SpriteAtlas asset would be wrong under the simulate mode

Discussion in 'Addressables' started by yuweichang, Dec 24, 2019.

  1. yuweichang

    yuweichang

    Joined:
    Nov 22, 2018
    Posts:
    6
    Hi,
    I just get an InvalidHandle error while trying to load a SpriteAtlas asset under the simulate mode.
    The version I'm using is v1.5.0, and I got the same error with v.1.4.0.

    How to reproduce:
    1. Create a SpriteAtlas asset and change the Addressable Name (like the attached file)
    2. Build asset bundles.
    3. Set the Play Mode Script as "Simulate Groups" and enter the play mode.
    4. Try to load the SpriteAtlas by the simplified addressable name.
    > ResourceManagerException encountered in operation InvalidHandle: Unable to load asset Assets/Tests/Packs/SampleSpriteAtlas.sSamplePack from simulated bundle...

    It look like BuildScriptVirtualMode treats the SpriteAtlas asset as an AssetBundle and attemps to rewrite the key with a hash code. But since the extension is not ".bundle", it just use the original key to rewrite itself.

    Assets/Tests/Packs/SampleSpriteAtlas.sSamplePack
    = "Assets/Tests/Packs/SampleSpriteAtlas.spriteatlas".Remove(startIndex) + "SamplePack"
    where startIndex = length of ("Assets/Tests/Packs/SampleSpriteAtlas.spriteatlas") - length of ("SamplePack")
     

    Attached Files:

    Upian likes this.
  2. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey @yuweichang, I'll send this post over for you so the team can have a look!
     
  3. yuweichang

    yuweichang

    Joined:
    Nov 22, 2018
    Posts:
    6
    It's great to hear this. Thanks a lot!