In my game initialization I need to load a series of assets.
I start by loading my scene, then I load specific asset because I need to access them like a TextAsset. However when I load the second asset, the task will never complete… If you break the process you just see that it will create task after task, like in a cycle.
If I don’t do the loadsceneasync first, all work well
AsyncOperationHandle<long> getDownloadSizeHandle = Addressables.GetDownloadSizeAsync(sceneStarfall);
yield return new WaitUntil(() => getDownloadSizeHandle.IsDone);
if (getDownloadSizeHandle.Status == AsyncOperationStatus.Succeeded)
{
long value = getDownloadSizeHandle.Result;
if (value == 0)
{
AsyncOperationHandle<SceneInstance> aoScene = sceneStarfall.LoadSceneAsync(LoadSceneMode.Single, false);
yield return new WaitUntil(() => aoScene.IsDone);
}
else
{
message = $"Downloading {value / 1024 / 1024}MB";
AsyncOperationHandle<SceneInstance> aoScene = sceneStarfall.LoadSceneAsync(LoadSceneMode.Single, false);
while (!aoScene.IsDone)
{
DownloadStatus ds = aoScene.GetDownloadStatus();
message = $"{ds.Percent * 100:f1}% completed ({ds.DownloadedBytes / 1024}/{ds.TotalBytes / 1024}kB)";
yield return new WaitForEndOfFrame();
}
myScene = aoScene.Result;
}
}
}
finally
{
if (!Succeed)
{
message = "Failed to download, please restart game";
}
else
{
// goStartGame.SetActive(true);
// goStatus.SetActive(false);
}
}
AsyncOperationHandle<TextAsset> aoEmojiJSON = Addressables.LoadAssetAsync<TextAsset>(@"Assets/Emoji/EmojiData.txt");
yield return new WaitUntil(() => aoEmojiJSON.IsDone);
Also, if I look at the AssetReference, even before I load them, they say done, and they already have all the required content inside them, like I don’t need to load them, any reason they start as “Done”
Thank