Search Unity

LocalizationSettings.AvailableLocales.Locales is empty on Unity Play

Discussion in 'Web' started by kor6k, Jul 13, 2022.

  1. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    Hello,
    I have a game running well on webgl.
    I tried to publish it on Unity Play but the game crash because LocalizationSettings.AvailableLocales.Locales gives empty list. When I upload my webgl on other websites, I don't have this issue; only with Unity Play.
    Do you know why?
    Thanks in advance
    kor6k
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Do you have a log file I can look at or an error message?
     
  3. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    Here is the log of the execution of the game in Unity Play:
    I hope you will be able to help.
     

    Attached Files:

  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    This error is likely the cause

    [B]HeroesOfWar.framework.js.br:3 RemoteProviderException : TextDataProvider : unable to load from url : https://play.unity.com/webgl/StreamingAssets/aa/settings.json
    UnityWebRequest result : ProtocolError : HTTP/1.1 404 Not Found[/B]


    Did you upload the Addressables asset data to that location?
     
  5. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Hi,
    I have spoken to the Addressables team. It seems strange that its using the wrong URL, they will look more into why this is happening on Unity Play. For now they have provided a workaround that will let you correct the URL.

    Run this code before you do anything with Localization/Addressables.

    Code (csharp):
    1. Addressables.InternalIdTransformFunc = (loc) =>
    2.        {
    3.            if (loc.InternalId.Contains("https://play.unity.com/webgl/"))
    4.                return loc.InternalId.Replace("https://play.unity.com/webgl/", "https://play-static.unity.com/20220712/webgl/3e1c4431-66b3-4f62-9637-b8cd802c74fb/");
    5.  
    6.            return loc.InternalId;
    7.        };
     
  7. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    Thanks, I will try this and keep you informed !
     
    karl_jones likes this.
  8. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    Unfortunately, it doesn't work... I still have the issue:

    Code (CSharp):
    1.  
    2. HeroesOfWar.loader.js:1 [UnityCache] 'https://play-static.unity.com/20220713/webgl/dd3d4351-6496-4863-84ab-4533cd5350ce/Build/HeroesOfWar.data.br' successfully downloaded and stored in the indexedDB cache
    3. HeroesOfWar.framework.js.br:3 absoluteURL: https://play.unity.com/webgl/dd3d4351-6496-4863-84ab-4533cd5350ce?screenshot=true&userID=62a9a8663bd2440b75aadd05&embedType=edit
    4.  
    5. HeroesOfWar.framework.js.br:3 GUID: dd3d4351-6496-4863-84ab-4533cd5350ce
    6.  
    7. HeroesOfWar.framework.js.br:3          GET https://play-static.unity.com/20220713/webgl/dd3d4351-6496-4863-84ab-4533cd5350ce/StreamingAssets/aa/settings.json 404 (Not Found)
    8. _JS_WebRequest_Send @ HeroesOfWar.framework.js.br:3
    I tried to check the URL https://play-static.unity.com/20220...4533cd5350ce/StreamingAssets/aa/settings.json and indeed, the file is not here... I don't understand why because the folder is in the zip file I uploaded...
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Is that address correct for the game? Is the game public? Can you share a link so I can take a look?
     
  10. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
  11. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    I tried to find the location of the StreamingAssets folder after deploying the game but I cannot find it...
    Is it possible that this folder has not been installed during the installation of the game on Unity Play?
     
  12. kor6k

    kor6k

    Joined:
    Jan 8, 2017
    Posts:
    50
    I found a work around; I modified the code you sent to me to change the StreamingAssets path with the path of my game working on another domain:

    Code (CSharp):
    1. Addressables.InternalIdTransformFunc = (loc) =>
    2.        {
    3.            if (loc.InternalId.Contains("https://play.unity.com/webgl/"))
    4.                return loc.InternalId.Replace("https://play.unity.com/webgl/", "https://files.crazygames.com/heroe-of-war/1/");
    5.            return loc.InternalId;
    6.        };
    It's very ugly but it works!
    If someone has a better idea, don't hesitate to post it ;-)
     
    karl_jones likes this.
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Nice. Ill try and chase the play team and see if there's something we are doing wrong.