Search Unity

Question UnityEngine.Localization null reference exception on ipad build version.

Discussion in 'Localization Tools' started by ptuananh196, Jul 21, 2021.

  1. ptuananh196

    ptuananh196

    Joined:
    Mar 16, 2020
    Posts:
    4
    Hi, i'm trying to integrate the new localization package version 1.0.0 - pre.9 to my apps. I added 3 locales and creates multiple tables for each scenes in the apps. For locale switcher, i use the prefab "Language Menu - Dropdown" in language selection menu UGI sample that localization package provide. Then i do the default build for addressable on both ios and windows. It worked fine in editor and the windows build version. But when i switch to ios, install and build the apps on ipad, the below are the error log on xcode:

    Code (Boo):
    1. NullReferenceException: Object reference not set to an instance of an object.
    2.   at UnityEngine.Localization.Settings.LocalesProvider.get_PreloadOperation () [0x00000] in <00000000000000000000000000000000>:0
    3.   at UnityEngine.Localization.Settings.LocalizationSettings.GetSelectedLocaleAsync () [0x00000] in <00000000000000000000000000000000>:0
    4.   at UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].GetTableAsync (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Locale locale) [0x00000] in <00000000000000000000000000000000>:0
    5.   at UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].GetTableEntryAsync (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) [0x00000] in <00000000000000000000000000000000>:0
    6.   at UnityEngine.Localization.LocalizedString.HandleLocaleChange (UnityEngine.Localization.Locale _) [0x00000] in <00000000000000000000000000000000>:0
    7.   at UnityEngine.Localization.LocalizedString.add_StringChanged (UnityEngine.Localization.LocalizedString+ChangeHandler value) [0x00000] in <00000000000000000000000000000000>:0
    Below are the code inside the prefab. On scene, the dropdown show "Loading..." as it seems the locale is empty for some reason.
    Code (CSharp):
    1.       void Start()
    2.         {
    3.             // First we setup the dropdown component.
    4.             m_Dropdown = GetComponent<Dropdown>();
    5.             m_Dropdown.onValueChanged.AddListener(OnSelectionChanged);
    6.  
    7.             // Clear the options an add a loading message while we wait for the localization system to initialize.
    8.             m_Dropdown.ClearOptions();
    9.             m_Dropdown.options.Add(new Dropdown.OptionData("Loading..."));
    10.             m_Dropdown.interactable = false;
    11.  
    12.             // SelectedLocaleAsync will ensure that the locales have been initialized and a locale has been selected.
    13.             m_InitializeOperation = LocalizationSettings.SelectedLocaleAsync;
    14.             if (m_InitializeOperation.IsDone)
    15.             {
    16.                 InitializeCompleted(m_InitializeOperation);
    17.             }
    18.             else
    19.             {
    20.                 m_InitializeOperation.Completed += InitializeCompleted;
    21.             }
    22.         }
    How can i fix this problem?

    Thanks in advance,
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Hi,
    We are just about to release 1.0.0-pre.10. which may fix this issue. If after updating you still have the problem could you please share the full log file and/or file a bug report?
     
  3. yeayeatisk

    yeayeatisk

    Joined:
    Jan 22, 2021
    Posts:
    1
    Hi!
    I'm getting a similar issue.
    I've got 1.0.5 Localization package version. In editor is working fine, but when i build for my Android device it doesn't work.
    I'm trying to figure out what happens but i'm not getting any error, the function InitializeCompleted is never called.
    Is a minimun android API level requirement?

    Thanks in advance.