Metadata is null

Hello,

We have an issue where returned metadata in code is null. It sometimes is an issue and sometimes is not.
We discovered this issue quite randomly in one of our Windows builds and then also while playing inside the editor. The code has always worked fine before, only recently it broke. We are not sure what caused this or what is happening.

I’ll describe the situation.

  1. We’ve set up some metadata for some entries in our asset localization table.8979808--1235245--upload_2023-4-28_17-46-50.png

  2. We’ve written some custom code to retrieve the metadata.

  3. However, sometimes the returned metaData is null and sometimes it isn’t. We aren’t able to pinpoint when it is null or when it isn’t. We have two locales, and the issue is present in both.
    Also, there are no errors, warnings or regular logs.

We’ve built the addressables a few times. We’ve used the analyze tool, and there’s nothing to fix.
Unity version 2021.3.20f1
Addressables 1.19.19
Localization 1.3.1
Testing on Windows 10. The issue is present both in the editor and in the build.
Play mode script: Use existing build (Windows).

Do you have any ideas what could cause this? What else could I check to make sure everything is set up correctly?

From looking at your code there is a part in GetMetdata that returns default when the entry is not loaded, could it be that? Maybe try
entry.WaitForCompletion when it’s not done?

I just discovered that if I set Play Mode Script to ‘Use Asset Database’, then it works correctly in the Editor (haven’t tried the build yet).

I also tried your suggestion but no luck:

if (!entry.IsDone)
    entry.WaitForCompletion();

I cleaned the build via Addressables Groups->Build->Clean Build->All.
I then rebuilt the addressables.
And now it works. Not sure if this is just a ‘lucky’ addressables build where it works, or if there is something else going on.

It sounds like it is the issue I mentioned. Using Asset Database mode means that all operations are complete immediately, when you run this in the player this won’t be the case and you will have the same problem again.
Try calling GetTableEntry instead of GetTableEntryAsync.

No, after I cleaned and rebuilt I also switched to ‘Use existing build (Windows)’. And it works. Confirmed in the build as well. I haven’t currently changed the code to what you suggested.

1 Like