GetMetadata returns null

Hello,

I’ve a case where I am trying to get metadata at runtime but it returns null. It worked before but now has suddenly stopped working. I cleared the addressables cache and rebuilt it. It doesn’t work in the editor with the “Use Existing Build” play mode script nor in the build.
It does work correctly with PMS set to “Use Asset Database”.

The metadata is clearly setup in the table and exists but the code returns null for some reason.
9223752--1287942--upload_2023-8-15_13-41-12.png

Unity 2021.3.20f1
Addressables 1.19.19
Localization 1.3.1

Is this metadata using #if UNITY_EDITOR?
Can you print out all the metadata with localizedAudioClip.MetadataEntries?
It sounds like ti may be going null during Addressables building, which usually indicates the script is not available in the build.

The metadata script is not using #if UNITY_EDITOR, and the script is in the default assembly Assembly-CSharp.dll.

Also, there is no MetadataEntries property available on LocalizedAudioClip. Only the GetMetadata() function.

LocalizedAudioClip

using System;

namespace UnityEngine.Localization
{
  [Serializable]
  public class LocalizedAudioClip : LocalizedAsset<AudioClip>
  {
  }
}

It’s strange that it’s working in editor but not player. It makes me think that something is still being cached. Can you test it on a different machine?
Can you try calling clear cache?

I just discovered I had written about the same exact issue here: Metadata is null .

I implemented your solution of using the non-async version, rebuilt the addressables and it seems to be working in both the editor and the build.

Ohhh I did wonder what version of GetMetadata you were using.
Instead of checking isDone you could also try calling WaitForCompletion.