Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug LocalizedAssetTable.GetTableAsync return null on webgl build

Discussion in 'Localization Tools' started by Twil75, Jun 11, 2022.

  1. Twil75

    Twil75

    Joined:
    Aug 30, 2012
    Posts:
    22
    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:

    Code (CSharp):
    1.  
    2. public IEnumerator GetMyTable(LocalizedAssetTable d)
    3.     {
    4.         yield return LocalizationSettings.InitializationOperation;
    5.  
    6.         var tableOp = d.GetTableAsync();
    7.         yield return tableOp;
    8.  
    9.         AssetTable table = tableOp.Result;
    10.  
    11.         if (table == null)
    12.         {
    13.             result = "Table NULL";
    14.             Debug.Log("<color=red>"+ result+"</color>");
    15.         }
    16.         else
    17.         {
    18.             result = "Table OK";
    19.             Debug.Log("<color=green>" + result + "</color>");
    20.             var tableOp2 = LocalizationSettings.AssetDatabase.GetLocalizedAssetAsync<Texture2D>(d.TableReference, "T");
    21.             yield return tableOp2;
    22.             tex = tableOp2.Result;
    23.         }
    24.     }
    25.  
    # 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
     
    Last edited: Jun 11, 2022
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    The error happens when using synchronous API in webgl but I can't see you using any in your code example. Maybe somewhere else?
     
  3. Twil75

    Twil75

    Joined:
    Aug 30, 2012
    Posts:
    22
    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)
    .....
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    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?
     
  5. Twil75

    Twil75

    Joined:
    Aug 30, 2012
    Posts:
    22
    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 ?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    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.
     
  7. Twil75

    Twil75

    Joined:
    Aug 30, 2012
    Posts:
    22
    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...
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    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.
     
  9. Twil75

    Twil75

    Joined:
    Aug 30, 2012
    Posts:
    22
    Thanks !
     
    karl_jones likes this.