Hi,
I have a project where I want to load some Sprites using addressables, everything work perfectly fine on Editor (using Play Mode Script Android) . However after building the project (Android) I couldn’t manage to get the addressables loaded on my Launch Scene. After loading the second Scene, I am able to see the the addressables loaded correctly. What could be happening?
From the logs, Addressables are initiated correctly before I try to run LoadAssetAsync:
I/Unity: Initializing Addressables version 1.21.20.
....
I/Unity: Addressables - Content catalog load result = UnityEngine.AddressableAssets.ResourceLocators.ContentCatalogData.
I/Unity: Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider with id UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider.
I/Unity: Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider with id UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.
I/Unity: Addressables - added provider UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider with id UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider.
I/Unity: Addressables - initialization complete.
I am trying to run this at startup on Android device:
private IEnumerator LoadTestSprite()
{
var handler = Addressables.LoadAssetAsync<Sprite>("TestImage");
Debug.Log("Loading Asset . . . ");
handler.Completed += (handle) =>
{
Debug.Log($" HANDLE COMPLETED {handle.Status}");
_mainImageComponent.sprite = handle.Result;
OnSpriteLoaded?.Invoke();
};
handler.Destroyed += (handle) => { Debug.Log($" HANDLE DESTroyed {handle.Status} {handle.OperationException.Message}"); };
handler.CompletedTypeless += (handle) => { Debug.Log($" HANDLE COMPLETED TYPELESS {handle.Status} "); };
StartCoroutine(LogHandlerStatus(handler,"LoadSprite"));
Debug.Log($"TEST {handler.Status} ");
yield return handler;
}
private IEnumerator LogHandlerStatus(AsyncOperationHandle handler, string name)
{
while (!handler.IsDone)
{
Debug.Log($"Handler information {name} : {handler.Status} {handler.PercentComplete}");
yield return new WaitForSeconds(2f);
}
}
However the handler seem to be stuck at 0.25
I/Unity: Handler information LoadSprite : None 0.25