The problem is simple: I’m loading an spritesheet with Addressables, and then accessing the individual sprites through the returned IList by index:
IList<Sprite> sprites = await AssetLoader.LoadAssetReference<IList<Sprite>>(spritesRefs[currentSprites]);
SpriteRenderer.sprite = sprites[currentSprite];
Nothing too complex, it works well. That’s it, until you build the Addressables and use the “Use Existing Build” in Play Mode Script or build the game and execute it outside the Editor, then when it should show the sprite in index 8 it show index 4 instead for some reason beyond my comprehension.
Anyone knows why and / or have a possible solution? Thanks in advance!
I’ll forward to the team for some input. Which version of Addressables are you using?
Thanks! I tried with both 1.15.1 and 1.16.16 in Unity 2020.2.3f with the same result.
If someone has the same problem and until it’s fixed, I recommend using Unity’s SpriteAtlas instead of spritesheets with IList in the meantime if that is an option.
Hi,
I tried producing this behaviour, but did not work. If possible, could you file a bug report displaying the problem?
It’s good that SpriteAtlases work for you. It may be personal preference, but SpriteAtlas can give you more control if you need to modify your Sprite setup later down the line. e,g mix more SpriteSheets together. So it is good that works for you.
I’m encountering the same issue, and was able to reproduce it. I submitted a bug report (1393960). It’d be really nice if this was addressed, as I have so many sprites that it would be very painful to convert them all to sprite atlases. 