Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

com.unity.localization without addressables

Discussion in 'Localization Tools' started by arnaldoGaroto, Feb 11, 2021.

  1. arnaldoGaroto

    arnaldoGaroto

    Joined:
    Feb 3, 2013
    Posts:
    22
    The localization components are great but the addressables are causing so much trouble (especially if you don't need any of the benefits that addressables bring)

    I know that the fact that the localization tables are addressables is a central feature, but has anyone tried to fork out the source to try to use the same system, editor and components but without relying on addressables for deployment? Anything simple like a csv file would do.
     
    pslz, Korindian and Chris16514 like this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    The earlier versions did just use asset files(json) however the problem arises when you need to support getting these asset files from different locations, platforms, servers etc. Managing the loading and unloading, especially of assets.
    Essentially we needed an Addressable asset system and one came along at just the right time ;)

    What problems are you having with Addressables? Maybe we can improve that side of things.
     
  3. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I agree. I've spent a lot of time trying to get Addressables to be modding friendly, and it's just not. The easiest way to do modding is with AssetBundles directly, or by loading json/csv etc. and other files directly from the file system. Addressables just complicates everything unnecessarily for my use case. There's been many long threads on the Addressables forum regarding modding, and Unity staff never really gives any input in them. I've also given feedback on Addressables surveys about it. But it doesn't look like it's really a priority for the Addressables team.

    I also would love to use the localization system you guys are developing, but when I saw that it relies on Addressables, I had to decide to stick with my own system. I can understand why you've chosen to go the Addressables route given all the things you need to support, but it would be nice to be able to have the localization database in the editor, then be able to serialize it to json/csv/xml or whatever in the editor to a chosen file location, and then be able to just import those files in at runtime. This makes the files easily editable in a build without having to use Addressables to create an AssetBundle for it. Will this be possible in the future?
     
    Last edited: Feb 12, 2021
    Baggers_ likes this.
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Yes we have plans to support this in the future. It is possible to do this through addressables, they don't have to be asset bundles. This user wrote some code to use Csv https://forum.unity.com/threads/creating-stringtable-at-runtime.999439/
     
    Kirsche and Korindian like this.
  5. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Does anyone found a way to build a project, that is using the localization feature, without the addressables?
    As Korindian said the localization feature is awesome but I'm having problems because of addressables.
    My builds are having font problems (they aren't being loaded properly) and if I do the same build without the addressables then my font problem is fixed, but then I lose the localization feature benefits.
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    This is not possible at the moment. Addressables is a core component. We are making changes in 2.0 to make it easier to extend the system without using addressables but we won't be completely removing addressable support, we would just have to create a new addressable system to replace it which makes no sense.
    It would be simpler for us to fix the font issues you are having rather than create a new system ;)
    Have you filled a bug report?
     
    lilacsky824 likes this.
  7. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Hi Karl. Thank you for your answer.
    Yes! I filled in a bug report.
    I'm asking for this workaround because I figured out today that the problem was with the addressables and I thought someone could have found a solution for that.
    I hope we find a solution soon. :)
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Do you have the bug number? Maybe I can find a workaround.
     
  9. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Yes. It is case 1425287.
    When I submitted the bug my workaround script was working if my project have all text fields active on the scene.
    However, the bug still occurs if I have hidden text fields that will appear after some interaction or if I change the current scene.
    So now, even with the workaround script, I'm having problems with the text and fonts. Sometimes my scene is loaded with a blank text field because somehow the font is not loaded and the content isn't visible.
    My workaround script just set the correct font for a text field if the Localization Settings change. I got it from here: https://forum.unity.com/threads/localize-font.898421/

    Thank you Karl
     
    karl_jones likes this.
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Hey. It looks like this may be a bug with TextMeshPro. QA has now reproduced the issue. Unfortunately, I cant see a workaround for this at the moment. I think it could be related to WebGL.
     
    pslz likes this.
  11. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Hi Karl,

    Thank you for checking this bug. I did the build for Windows and the bug still happens, so I don't believe it's a WebGL problem. It's good to know that can be a problem with TextMeshPro.

    What I think it's weird is that this bug occurs when I use the addressable, even if I didn't change the language while I'm using a build.
    When I create a build without the addressable my fonts work properly.

    In any case, I'll check this thread frequently to see if anyone has some updates and I'll wait for the bug report answer.

    Thank you again for your help.
     
  12. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Hi Karl,
    I did another test and it works as a workaround if I use that script to update the font and remove the font changes from the Game Object Localizer component (check the image)
     
    karl_jones likes this.
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    pslz likes this.
  14. pslz

    pslz

    Joined:
    Sep 23, 2015
    Posts:
    21
    Awesome! Thank you, Karl.
    Do you know when the next release will be available?
     
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    1.4 is due in October although we will aim to do a 1.3 patch release around June.
     
    pslz likes this.
  16. Femidko

    Femidko

    Joined:
    Aug 4, 2013
    Posts:
    57
    After
    Code (CSharp):
    1. Resources.UnloadUnusedAssets();
    2. or
    3. AssetBundle.UnloadAllAssetBundles(true);
    4.  
    is used an exception occurs:

    MissingReferenceException: The object of type 'StringTable' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Object.get_name () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:189)
    UnityEngine.Localization.Tables.LocalizationTable.VerifySharedTableDataIsNotNull () (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Tables/LocalizationTable.cs:154)
    UnityEngine.Localization.Tables.LocalizationTable.FindKeyId (System.String key, System.Boolean addKey) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Tables/LocalizationTable.cs:147)
    UnityEngine.Localization.Tables.DetailedLocalizationTable`1[TEntry].GetEntry (System.String key) (at Library/PackageCache/com.unity.localization@1.4.4/Runtime/Tables/DetailedLocalizationTable.cs:521)
    GU.Launcher.Services.Localization.LocalizationStringTable.GetString (System.String stringName) (at Assets/Game/Client/Launcher/Scripts/Runtime/Services/Localization/LocalizationStringTable.cs:16)

    How can I prevent this and prevent tables from being unloaded?

    Unity 2019.4.34f1. Localization 1.4.5
     
    Last edited: Nov 16, 2023
  17. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Tables are stored in Asset bundles so if you do
    AssetBundle.UnloadAllAssetBundles(true)
    then its going to unload them. Why are you doing that?
     
  18. Femidko

    Femidko

    Joined:
    Aug 4, 2013
    Posts:
    57
    When we exit the game scene and go to the lobby scene, we must unload all assets used by the game
     
    Last edited: Nov 16, 2023
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    That method unloads all assets including the ones being used.
    You should unload the ones you know are not being used.
    If you are using Addressables to handle it then you should release any references you have to assets and it will unload them for you.