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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Localization for Mobile

Discussion in 'Localization Tools' started by BeorGames, Oct 30, 2021.

  1. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    63
    Hello Karl,

    It's me again... :oops:

    I've finished implementing localization, all my text is working on PC (about 70% fine, I'll explain later), but now I'm trying to use it on mobile, as my game is for Android.

    I haven't found any extra step that was needed to make it work on mobile, so I just followed the tutorials, the problem is that the language won't change, I'm getting this error:

    Code (CSharp):
    1. 10-30 18:50:39.853 14971 27703 E Unity   : MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[[System.Collections.Generic.IList`1[[UnityEngine.Localization.Locale, Unity.Localization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
    2. 10-30 18:50:39.853 14971 27703 E Unity   :   at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
    3. 10-30 18:50:39.853 14971 27703 E Unity   :   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
    4. 10-30 18:50:39.853 14971 27703 E Unity   :   at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00000] in <00000000000000000000000000000000>:0
    5. 10-30 18:50:39.853 14971 27703 E Unity   :   at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, UnityEngine.ResourceManagement.Util.IOperationCacheKey cacheKey, System.Action`1[T] onDestroyAction) [0x00000] in <00000000000000
    Found it using the command prompt and using: Unity\Hub\Editor\2020.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools>adb logcat Unity: D *:S
    Here's a pic to better ilustrate what happens every time I click the button that was supposed to change the language.

    upload_2021-10-30_18-55-22.png

    And here's the function the button calls:
    Code (CSharp):
    1. public void SetLocale(Locale locale)
    2.     {
    3.         LocalizationSettings.SelectedLocale = locale;
    4.         m_InitializeOperation = LocalizationSettings.SelectedLocaleAsync;
    5.     }
    Here's my translation code, in case it helps:
    Code (CSharp):
    1.     public string Translate (string source)
    2.     {
    3.         LocalizedString stringComponent = new LocalizedString();
    4.         stringComponent.TableReference = "Revenot Localization";
    5.         stringComponent.TableEntryReference = source;
    6.  
    7.         return stringComponent.GetLocalizedString();      
    8.     }
    And lastly, but not least, I said 70% of the times before, because on PC sometimes instead of translating the texts it shows a message "Loading...", but it never loads, I have to stop the application and run it again to translate.

    I know it's a bit long this post, but I truly believe you can help me ;)
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    The first issue can be fixed by updating to the latest version of 2020.3.
    See if you still have the other problem after that.
     
  3. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    63
    I'm using 2020.3 already upload_2021-10-30_19-49-5.png
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    That's an old version, you need the latest patch version. Update to the latest version of 2020.3 via the hub
     
  5. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    63
    Hello,

    I've updated to version upload_2021-10-31_19-39-21.png but I'm still getting the same error:
    Code (CSharp):
    1. 10-31 19:38:40.624 27830 29579 E Unity   : MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[[System.Collections.Generic.IList`1[[UnityEngine.Localization.Locale, Unity.Localization, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
    2. 10-31 19:38:40.624 27830 29579 E Unity   :   at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
    3. 10-31 19:38:40.624 27830 29579 E Unity   :   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
    4. 10-31 19:38:40.624 27830 29579 E Unity   :   at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00000] in <00000000000000000000000000000000>:0
    5. 10-31 19:38:40.624 27830 29579 E Unity   :   at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, UnityEngine.ResourceManagement.Util.IOperationCacheKey cacheKey, System.Action`1[T] onDestroyAction) [0x00000] in <00000000000000
    Here's a pic: upload_2021-10-31_19-41-23.png
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    Did you rebuild the addressable assets after updating?
     
  7. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    63
    Sorry, but I have no clue what that means...

    I searched for a solution on the forums and found this https://forum.unity.com/threads/addressables-and-code-stripping-il2cpp.700883/#post-5202515, tried the solution that says to add this link.xml
    Code (JavaScript):
    1. <linker>
    2.     <assembly fullname="Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
    3.     <type fullname="UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider" preserve="all" />
    4.     <type fullname="UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider" preserve="all" />
    5.     <type fullname="UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider" preserve="all" />
    6.     <type fullname="UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider" preserve="all" />
    7.     <type fullname="UnityEngine.ResourceManagement.AsyncOperations" preserve="all" />
    8.     </assembly>
    9.     <assembly fullname="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
    10.     <type fullname="UnityEngine.AddressableAssets.Addressables" preserve="all" />
    11.     </assembly>
    12. </linker>
    But it doesn't work as well.

    Can you indicate a tutorial for that?
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
  9. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    63
    karl_jones likes this.
  10. makizume

    makizume

    Joined:
    May 9, 2018
    Posts:
    26
    karl_jones likes this.