強火で進め

このブログではプログラム関連の記事を中心に書いてます。

Addressables パッケージの 1.8.3/1.8.4 で Sprite Atlas のロード時にエラー

f:id:nakamura001:20200528213220p:plain
この様な Sprite Atlas を作成し、 Box3 の Sprite を読み込むプログラムを書いた所、以下の様なエラーが発生しました。

Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[UnityEngine.Sprite], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=BoxAtlas[Box3], Type=UnityEngine.Sprite
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:<.ctor>b__33_0(AsyncOperationHandle)
DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.8.4/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.AddressableAssets.Initialization.<>c__DisplayClass14_0:<LoadContentCatalogInternal>b__0(AsyncOperationHandle`1)

調べてみるとこちらが見つかりました。バグ報告は既に行われている様です。

Loading sprites via AssetReferenceAtlasedSprite broken after upgrade to 1.8.3 - Unity Forum
https://forum.unity.com/threads/loading-sprites-via-assetreferenceatlasedsprite-broken-after-upgrade-to-1-8-3.873283/

一つ前のバージョン 1.7.5を使った場合にはエラー無く、実行されました。