Reference a localized string in a smart string

Hello,

I am trying to reference a localized string and get its value in a smart string.

AtomName here is a LocalizedString. When I check it in the inspector preview, it works correctly:

However, this is what I see in TextMeshPro - Text (UI) component:
7156393--856717--upload_2021-5-19_21-26-53.png

The necessary string tables are loaded.

I should also mention that I am changing the LocalizedString in the LocalizeStringEvent component where this is happening:

private void AtomStructureEvents_OnTaskActivatedLocalized(LocalizedString instruction)
{
     _localizeStringEvent.SetStringReference(instruction);
}

The SetStringReference is a custom extension method:

public static void SetStringReference(this LocalizeStringEvent stringUnityEvent, LocalizedString stringReference)
{
    stringUnityEvent.StringReference = stringReference;
    stringUnityEvent.TryRefreshString();
}

public static bool TryRefreshString(this LocalizeStringEvent stringUnityEvent) =>
            stringUnityEvent.gameObject.activeInHierarchy &&
            stringUnityEvent.enabled &&
            stringUnityEvent.StringReference.RefreshString();

What could be the issue here?

Thanks!

Hmm I’m not sure, I’d need to debug it.
Are you able to share an example project with this problem?

Have you rebuilt the addressable assets? We bypass them in the editor but in play mode it may be trying to use them.

I just added additional details. Are they of any help? Perhaps I am just doing things incorrectly.

Nothing stands out from your script. Are you passing in arguments for the strings?

I had forgotten to build the addressable assets. :slight_smile:

Thank you!