I have separated some of my assets into Addressables groups, some to be downloaded as DLC and one group that is always available (called “FreeBirds”). I’m loading assets async in the Scene (which is not an addressable) and sometimes it works, but randomly I’m getting the following error, which breaks loading of strings and even seemingly other assets (like AudioClip).
I’ve also attached an image of my Addressables groups (one of the DLCs, which I’m not using currently and the FreeBirds group). I’ve removed the “Preload” label from the strings, since it caused major issues with the loading.
I’m loading strings like this: new LocalizedString(table, id).GetLocalizedString();
@Limewood , Hey there, it sounds like this might have some interactions with the localization package which are unfortunately a bit outside of the scope of Addressables. That said, I’d be curious to see if the Localization package’s new version will fix this (As mentioned by Karl in the other thread). If not, I encourage you to post a bug report with the project that causes this issue so that we can take a look at it and figure out what’s going on from the Addressables side since unfortunately it seems hard to diagnose what exactly is going on from just this screenshot. Sorry for the inconvenience!
The only suggestion I really have in the meantime is to be certain that all of the bundles depended on by Assets/Addressables/Birds/Free/birdstrings/birdstrings_free_en.asset are able to be loaded - if they’re inaccessible or otherwise not loadable at the time that that asset is loaded it could lead to the error that’s being shown.
Are you localizing assets or just strings? If you are using assets, try disabling preloading on the asset tables. We currently have a bug with preloading, it will be fixed in 1.4.0.
I did have the “Preload” tag on the strings assets before, as well as asset tables, but as it was causing errors I removed them and asset tables don’t seem to have problems now.
The error above about downloaded strings assets still occurs, though and locks up the app.
The only dependencies to the birdstrings_dlc1_sv.asset (which is the one of the failing ones now) seem to be the “Shared Data” asset, which is in the same addressables group and is downloaded at the same time using DownloadDependenciesAsync([tag shared by all DLC1 assets]), so I don’t know why it would be unavailable.
Do I perhaps have to call the LocalizationSettings.InitializationOperation every time a new strings asset is downloaded?
I sometimes get the error even after a restart, though (where I call LocalizationSettings.InitializationOperation at the start).
The downloaded image assets work fine, it’s just the strings files that cause errors.
You don’t need to call LocalizationSettings.InitializationOperation, it will be added as a dependency to any localization calls so should not need to be called manually.
What version of the package are you using? Can you try the latest 1.3.2?
Ok, thanks, I’ll remove that call then. I thought it fixed an older similar issue, but maybe that was just a coincidence.
I’m using 1.3.2. Still get the same error after removing LocalizationSettings.InitializationOperation.
I download the assets in the following way (downloadTag is “DLC1” in this case):
long downloadSize = await Addressables.GetDownloadSizeAsync(downloadTag).Task;
Debug.Log("Download size: " + downloadSize);
//If the download size is greater than 0, download all the dependencies.
if (downloadSize > 0) {
var downloadHandle = Addressables.DownloadDependenciesAsync(downloadTag);
while (!downloadHandle.IsDone) {
ShowProgress(downloadHandle.GetDownloadStatus().Percent);
await Task.Yield();
}
}
and then getting the strings like this:
new LocalizedString(table, id).GetLocalizedString();
where tableId is “birdstrings_dlc1” and id is the string id.
I’ve also attached an image of the DLC1 addressables group (packed separately, but all using the same label).
It seems to work if it’s used straight after the assets are downloaded, but on the next start, I get the error (though GetDownloadSizeAsync says 0, so I assume all assets should be there locally).
Does this mean that any strings files,both local and downloaded (in cache) will be automatically initialized just by making a new LocalizedString? Is there a problem with calling this in a BindItem method for a UI Toolkit ListView?
I will try to make a new sample project where this problem can be reproduced, to submit a bug report.
I’ve created a small example project and submitted a bug report with it attached.
I hope this can help find the cause, as it happens for both remote (downloaded) and local strings now.
IN-18543
Thanks. They noticed you are using WaitForCompletion, there’s a known bug with that and cached bundles. A fix should be available in the next release so that may be the issue. They will know for sure once they have fully investigated it but it’s also worth updating once a new release is available to see if that fixes it.
Thank you. I’m not using WaitForCompletion directly, but maybe it is called by IsDone?
This is the download part of the example code.
var downloadHandle = Addressables.DownloadDependenciesAsync(downloadTag, true);
Debug.Log("Downloading...");
while (!downloadHandle.IsDone) {
ShowProgress(downloadHandle.GetDownloadStatus().Percent);
await Task.Yield();
}
The error doesn’t happen until I try to get a string from one of the bundles, though, the download seems to work fine and the error also happens for local bundles.
I don’t know if it’s related, but I’m having another issue where the app gets stuck on “GetLocalizedString” when started from the device (not launched through the editor). This is for a string in a default addressables group (Localization-String-Tables-Swedish (sv)), unlike the issue detailed in the bug report, but maybe they are connected?
To me it seems most likely to be related to the addressables groups, as GetLocalizedString didn’t cause this issue before I moved the strings assets into custom groups. Have the testers looked at the addressables group settings yet? Maybe that can give a hint? Is there anything more I could do to help the process?
It also gets stuck on the following line, if I include it in the code:
The info_free.json file is also part of the same local addressables group as the strings asset above.
Maybe I’m doing it all wrong? Is the Addressables system a very new system that isn’t quite ready for production yet? Should I be using something else?
Another update:
I think I have found the cause of the second issue (the app not getting past GetLocalizedString on restart).
I found out that GetLocalizedString uses WaitForCompletion internally (I can’t find the source code, but there was a comment about it in the latest API documentation, which was helpful, after I found my way to the correct version).
After moving all strings back to the local, default group and using GetLocalizedStringAsync, the app finally runs even when not launched through the editor!
So it seems the testers might be on the right track at least for the second issue (the first one I can work around by forgoing content updates of strings without updating the app). Do you know when the next release with a fix for the WaitForCompletion bug is planned for, @karl_jones ?
Is it possible to preload strings during the splash screen somehow?
Waiting for the strings to load asynchronously takes almost a whole second, which is a lot for a mobile app, on top of the 2 seconds of the splash screen, compared to the seemingly instant string loading before the workaround.
No, it’s not possible. Addressables is unable to load assets until the splash screen has finished. Whilst the splashscreen is running only a subset of the engine is available. How much are you preloading? Can you disable some so it only loads whats needed at the start?
Or maybe disable preloading completely and see how on-demand is.
Its probably not localization causing the delay then, more likely something on the Addressables side.You could try using the Addressables Profiler/Event Viewer to see whats going on
Thank you! The Event Viewer unfortunately seems quite buggy, or I’m missing something.
I can’t make the rightmost column wider (it is as small as possible) and if I click on a ‘+’ next to an event everything disappears and I can’t get it back. I don’t see any load times for any events here.
Are these known bugs and are there workarounds?