LocalizedAssetTable.GetTableAsync return null on webgl build

Hello

I have a simple project on unity 2021.2.11 on platform Webgl
Localization 1.0.5
Adressable 1.20.0

I created 2 Locale (fr, en)
I create an AssetTable just contain a texture (one for each locale)

Textures are in Adressables
I built adressable

I try to GetTableAsync using this coroutine:

public IEnumerator GetMyTable(LocalizedAssetTable d)
    {
        yield return LocalizationSettings.InitializationOperation;

        var tableOp = d.GetTableAsync();
        yield return tableOp;

        AssetTable table = tableOp.Result;

        if (table == null)
        {
            result = "Table NULL";
            Debug.Log("<color=red>"+ result+"</color>");
        }
        else
        {
            result = "Table OK";
            Debug.Log("<color=green>" + result + "</color>");
            var tableOp2 = LocalizationSettings.AssetDatabase.GetLocalizedAssetAsync<Texture2D>(d.TableReference, "T");
            yield return tableOp2;
            tex = tableOp2.Result;
        }
    }

Runing in editor with Adressable PlayMode : Use Asset Database → Ok table is not null

Runing in build webgl —> Table is Null

Runing in editor with Adressable PlayMode : Use Existing Build → Table is Null

I can avoid this NULL problem if i uncheck Preload on table, but on webgl build there are many errors in console (even if afterwards it seems to work because i can display texture)

By executing SelectedLocale commands several times on all locale, the GetTableAsync function ends up no longer returning null … so strange

Why GetAsyncTable return null in this cases ?
What way to use on webgl ?

[EDIT]
I saw that package manager on unity 2021.2.11 allow to install 1.0.5 localization version… (why not the last ?)
Then after add manualy the latest version (1.3.2) using “Add package from git url” with com.unity.localization, the problem disapear in editor.
In build webgl, it works too, but there is many errors in console at start :
Exception: WebGLPlayer does not support synchronous Addressable loading. Please do not use WaitForCompletion on the WebGLPlayer platform.

I can/must ignore it ?

Regads

The error happens when using synchronous API in webgl but I can’t see you using any in your code example. Maybe somewhere else?

My scene is only a basic scene (camera + light) with one object with my script on.
And this script does nothing at start, only when press GUI button.
Then errors fire in web console at start then without execution of my code.

one of this Error stack if can help:

ExportWeb.framework.js:3 Exception: WebGLPlayer does not support synchronous Addressable loading. Please do not use WaitForCompletion on the WebGLPlayer platform. at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
_JS_Log_Dump @ ExportWeb.framework.js:3
$func7380 @ ExportWeb.wasm:0x1f1b81
$func38802 @ ExportWeb.wasm:0xaeb2f9
$func18794 @ ExportWeb.wasm:0x55c792
$func510 @ ExportWeb.wasm:0x5f16f
$func7062 @ ExportWeb.wasm:0x1d065a
$func2302 @ ExportWeb.wasm:0xaffd2
$func43025 @ ExportWeb.wasm:0xc0ccd9
$func45099 @ ExportWeb.wasm:0xcbdb32
$func43034 @ ExportWeb.wasm:0xc0d8b2
$func5962 @ ExportWeb.wasm:0x18f99e
$func19784 @ ExportWeb.wasm:0x60269e
$func43039 @ ExportWeb.wasm:0xc0d9c7
$func41413 @ ExportWeb.wasm:0xb53a88
$func20848 @ ExportWeb.wasm:0x6bc5d1
$func20848 @ ExportWeb.wasm:0x6bc642
$func18747 @ ExportWeb.wasm:0x555d26
$si @ ExportWeb.wasm:0xac791f
browserIterationFunc @ ExportWeb.framework.js:3
callUserCallback @ ExportWeb.framework.js:3
runIter @ ExportWeb.framework.js:3
Browser_mainLoop_runner @ ExportWeb.framework.js:3
requestAnimationFrame (async)
requestAnimationFrame @ ExportWeb.framework.js:3
Browser_mainLoop_scheduler_rAF @ ExportWeb.framework.js:3
Browser_mainLoop_runner @ ExportWeb.framework.js:3
requestAnimationFrame (async)
requestAnimationFrame @ ExportWeb.framework.js:3
Browser_mainLoop_scheduler_rAF @ ExportWeb.framework.js:3
Browser_mainLoop_runner @ ExportWeb.framework.js:3
requestAnimationFrame (async)
…

WaitForCompletion is being used from a script somewhere. See if you can find where it’s coming from. Don’t use any of the synchronous API. I can’t see any in the code you posted earlier. Can you share the full code?

Yes you are right i used LocalizationSettings.SelectedLocale in OnGUI to display current locale and i suppose i must use SelectedLocaleAsync instead…
Thanks for your reply !

Other question:
Is it normal that the unity 2021.2.11 package manager only offers version 1.0.5 of the localization package? instead of the last version 1.3.2 ?

Yes we have to update the version but it only updates for the latest Unity release. This is considered to be the official version for that release.

Ok, unfortunaly this version has the bug mentioned in my first message.

I installed mannually the 1.3.2 package… seems no error but i’m afraid … can i do that without problem ?
I prefer not to change version of unity at this stage of the project…

You can use 1.3.2. this is just the version that shows in the package manager. 1.3.2 is verified for 2019.4 and above.

Thanks !

1 Like