Search Unity

Question LocalizationSettings.SelectedLocale.name fails during WebGL build?

Discussion in 'Scripting' started by AerionXI, Feb 3, 2023.

  1. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    This works fine in Editor & Windows builds, but when building in WebGL, I get javascript error when opening the WebGL demo.

    Code (CSharp):
    1. public static string GetDeviceLocaleName() { return LocalizationSettings.SelectedLocale.name; }
    How can I get this to work in WebGL?
     
  2. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    How would I call LocalizationSettings.SelectedLocale.name in WebGL?
     
  3. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    I don't get why it compiles fine in Windows but not in WebGL.
     
  4. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    I get the javascript error,

    Code (CSharp):
    1. Exception: WebGLPlayer does not support synchronous Addressable loading.  Please do not use WaitForCompletion on the WebGLPlayer platform.
    2.   at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
    3. _JS_Log_Dump @ WebGL.framework.js.gz:3
    even though I do not use ANY "WaitForCompletion" command.
     
  5. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    482
    I don't understand. I'm not even using `WaitForCompletion` at all.