Hello. When I try to get text with GetLocalizedStringAsync I get the following error:
My code:
Am I doing something wrong?
Hello. When I try to get text with GetLocalizedStringAsync I get the following error:
The code looks fine. Can you show the addressables group window which shows all the addressable assets?
Could you please expand the group’s so I can see the contents
Also are you using 1.1.1?
No, i use 1.0.5.
Could you try updating to 1.1.1, I think this is a bug that we fixed.
If you still have the issue in 1.1.1 then please file a bug report.
Updated. Rebooted unity. The error is still there.
What do I have to do? What file?
Hello there!
I have the same problem
I want to test another locale (“jp-JP”)
If I use testLocale an error is thrown
Version 1.1.1
Preload AllTables = true;
InitializeSynchronously = fasle;
public async Task Init()
{
// await LocalizationSettings.InitializationOperation.Task;
while (!LocalizationSettings.InitializationOperation.IsDone)
await Task.Yield();
if (testLocale != null)
{
LocalizationSettings.SelectedLocale = testLocale;
}
GameLog.Print("LOC", LocalizationSettings.SelectedLocale.ToString());
var loadingOperation1 = LocalizationSettings.StringDatabase.GetTableAsync("Main");
await Task.WhenAll(loadingOperation1.Task);
if (loadingOperation1.Status == AsyncOperationStatus.Succeeded)
{
Loc.SetStringTable(new Dictionary<string, StringTable>(){
{"main", loadingOperation1.Result},
});
}
else
{
UnityEngine.Debug.LogError("Could not load String Table");
}
localizationDone = true;
}
A table with the same key `Main` already exists. Something went wrong during preloading.
UnityEngine.Localization.PreloadDatabaseOperation`2<UnityEngine.Localization.Tables.StringTable, UnityEngine.Localization.Tables.StringTableEntry>:LoadTableContents (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>)
DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>) (at Library/PackageCache/com.unity.addressables@1.19.15/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>:OnWrappedCompleted (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>)
DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.Localization.Tables.StringTable>>) (at Library/PackageCache/com.unity.addressables@1.19.15/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update (single)
MonoBehaviourCallbackHooks:Update () (at Library/PackageCache/com.unity.addressables@1.19.15/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:26)
if PreloadAlltables == false all OK
if InitializeSynchronously== true all OK
Could you please file a bug report?
Ok
Done
Case 1399230
I have the same issue, it is only one table out of 3 localization tables in my project. I have tried renaming it and deleting the Library folder contents but that did not fix the issue.
Aside from the error message the project seems to work normally.
Could you please file a bug report?
I can’t share my whole project but I just noticed this:
The table that returns the error is marked Preload while the others are not.
And I’m using this code for initialization:
public void InitLocale()
{
var sd = LocalizationSettings.StringDatabase;
var op = sd.GetDefaultTableAsync();
if (op.IsDone) InitializeCompleted(op);
else op.Completed += InitializeCompleted;
var op2 = sd.GetTableAsync("NumericAnnotationGlyphs");
if (op2.IsDone) NagInitializeCompleted(op2);
else op2.Completed += NagInitializeCompleted;
var op3 = sd.GetTableAsync("Hints");
if (op3.IsDone) HintInitializeCompleted(op3);
else op3.Completed += HintInitializeCompleted;
}
Now, if I comment out the initialization part for “Hints” then the error is gone, so how do I remove the preload and/or what is the correct code to handle a preloaded table?
You shouldn’t need to do anything different, this is a bug.
You can remove the preload in the table editor https://docs.unity3d.com/Packages/com.unity.localization@1.1/manual/StringTables.html#preloading
I don’t have this panel on the right:
I’m on Unity 2021.2.10f1 atm.
ETA: found it, I had to click the button above the locale name, I removed preload and the error is gone.
Confirmed IN-1890
Here is another bug report, I have reported another issue and that one came out:
Case: 1411102